diff --git a/.github/workflows/polkadot-companion-labels.yml b/.github/workflows/polkadot-companion-labels.yml
deleted file mode 100644
index 0a5af09358524..0000000000000
--- a/.github/workflows/polkadot-companion-labels.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-name: Check Polkadot Companion and Label
-
-on:
- pull_request:
- types: [opened, synchronize]
-
-jobs:
- check_status:
- runs-on: ubuntu-latest
- steps:
- - name: Monitor the status of the gitlab-check-companion-build job
- uses: s3krit/await-status-action@v1.0.1
- id: 'check-companion-status'
- with:
- authToken: ${{ secrets.GITHUB_TOKEN }}
- ref: ${{ github.event.pull_request.head.sha }}
- contexts: 'continuous-integration/gitlab-check-dependent-polkadot'
- timeout: 1800
- notPresentTimeout: 3600 # It can take quite a while before the job starts on Gitlab when the CI queue is large
- failureStates: failure
- interruptedStates: error # Error = job was probably cancelled. We don't want to label the PR in that case
- pollInterval: 30
- - name: Label success
- uses: andymckay/labeler@master
- if: steps.check-companion-status.outputs.result == 'success'
- with:
- remove-labels: 'A7-needspolkadotpr'
- - name: Label failure
- uses: andymckay/labeler@master
- if: steps.check-companion-status.outputs.result == 'failure'
- with:
- add-labels: 'A7-needspolkadotpr'
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b4933333b3418..765112bfa9e62 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -82,18 +82,31 @@ default:
tags:
- kubernetes-parity-build
-.rust-info-script: &rust-info-script
+.rust-info-script:
script:
- rustup show
- cargo --version
- rustup +nightly show
- cargo +nightly --version
+.pipeline-stopper-vars:
+ script:
+ - echo "Collecting env variables for the cancel-pipeline job"
+ - echo "FAILED_JOB_URL=${CI_JOB_URL}" > pipeline-stopper.env
+ - echo "FAILED_JOB_NAME=${CI_JOB_NAME}" >> pipeline-stopper.env
+ - echo "PR_NUM=${CI_COMMIT_REF_NAME}" >> pipeline-stopper.env
+
+.pipeline-stopper-artifacts:
+ artifacts:
+ reports:
+ dotenv: pipeline-stopper.env
+
.docker-env:
image: "${CI_IMAGE}"
before_script:
- !reference [.rust-info-script, script]
- !reference [.rusty-cachier, before_script]
+ - !reference [.pipeline-stopper-vars, script]
after_script:
- !reference [.rusty-cachier, after_script]
tags:
@@ -196,7 +209,6 @@ include:
# publish jobs
- scripts/ci/gitlab/pipeline/publish.yml
-
#### stage: deploy
deploy-prometheus-alerting-rules:
@@ -223,10 +235,16 @@ deploy-prometheus-alerting-rules:
# This job notifies rusty-cachier about the latest commit with the cache.
# This info is later used for the cache distribution and an overlay creation.
+# Note that we don't use any .rusty-cachier references as we assume that a pipeline has reached this stage with working rusty-cachier.
rusty-cachier-notify:
stage: notify
- extends: .docker-env
+ extends: .kubernetes-env
+ variables:
+ CI_IMAGE: paritytech/rusty-cachier-env:latest
+ GIT_STRATEGY: none
+ dependencies: []
script:
+ - curl -s https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.parity.io/parity/infrastructure/ci_cd/rusty-cachier/client/-/raw/release/util/install.sh | bash
- rusty-cachier cache notify
#### stage: .post
@@ -234,23 +252,61 @@ rusty-cachier-notify:
# This job cancels the whole pipeline if any of provided jobs fail.
# In a DAG, every jobs chain is executed independently of others. The `fail_fast` principle suggests
# to fail the pipeline as soon as possible to shorten the feedback loop.
-cancel-pipeline:
+.cancel-pipeline-template:
stage: .post
- needs:
- - job: test-linux-stable
- artifacts: false
- - job: test-linux-stable-int
- artifacts: false
- - job: cargo-check-subkey
- artifacts: false
- - job: cargo-check-benches
- artifacts: false
- - job: check-tracing
- artifacts: false
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
when: on_failure
variables:
PROJECT_ID: "${CI_PROJECT_ID}"
+ PROJECT_NAME: "${CI_PROJECT_NAME}"
PIPELINE_ID: "${CI_PIPELINE_ID}"
- trigger: "parity/infrastructure/ci_cd/pipeline-stopper"
+ FAILED_JOB_URL: "${FAILED_JOB_URL}"
+ FAILED_JOB_NAME: "${FAILED_JOB_NAME}"
+ PR_NUM: "${PR_NUM}"
+ trigger:
+ project: "parity/infrastructure/ci_cd/pipeline-stopper"
+ # remove branch, when pipeline-stopper for polakdot is updated to the same branch
+ branch: "as-improve"
+
+# need to copy jobs this way because otherwise gitlab will wait
+# for all 3 jobs to finish instead of cancelling if one fails
+cancel-pipeline-test-linux-stable1:
+ extends: .cancel-pipeline-template
+ needs:
+ - job: "test-linux-stable 1/3"
+
+cancel-pipeline-test-linux-stable2:
+ extends: .cancel-pipeline-template
+ needs:
+ - job: "test-linux-stable 2/3"
+
+cancel-pipeline-test-linux-stable3:
+ extends: .cancel-pipeline-template
+ needs:
+ - job: "test-linux-stable 3/3"
+
+cancel-pipeline-cargo-check-benches1:
+ extends: .cancel-pipeline-template
+ needs:
+ - job: "cargo-check-benches 1/2"
+
+cancel-pipeline-cargo-check-benches2:
+ extends: .cancel-pipeline-template
+ needs:
+ - job: "cargo-check-benches 2/2"
+
+cancel-pipeline-test-linux-stable-int:
+ extends: .cancel-pipeline-template
+ needs:
+ - job: test-linux-stable-int
+
+cancel-pipeline-cargo-check-subkey:
+ extends: .cancel-pipeline-template
+ needs:
+ - job: cargo-check-subkey
+
+cancel-pipeline-check-tracing:
+ extends: .cancel-pipeline-template
+ needs:
+ - job: check-tracing
diff --git a/Cargo.lock b/Cargo.lock
index d7b1350c1f529..da047d4cba6d8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -230,7 +230,7 @@ dependencies = [
"parking",
"polling",
"slab",
- "socket2 0.4.4",
+ "socket2",
"waker-fn",
"winapi",
]
@@ -310,7 +310,7 @@ dependencies = [
"futures-io",
"futures-util",
"pin-utils",
- "socket2 0.4.4",
+ "socket2",
"trust-dns-resolver",
]
@@ -382,12 +382,6 @@ dependencies = [
"winapi",
]
-[[package]]
-name = "autocfg"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
-
[[package]]
name = "autocfg"
version = "1.0.1"
@@ -446,6 +440,7 @@ dependencies = [
name = "beefy-gadget"
version = "4.0.0-dev"
dependencies = [
+ "async-trait",
"beefy-primitives",
"fnv",
"futures",
@@ -454,6 +449,7 @@ dependencies = [
"log",
"parity-scale-codec",
"parking_lot 0.12.0",
+ "sc-block-builder",
"sc-chain-spec",
"sc-client-api",
"sc-consensus",
@@ -511,10 +507,12 @@ dependencies = [
name = "beefy-merkle-tree"
version = "4.0.0-dev"
dependencies = [
- "env_logger 0.9.0",
+ "beefy-primitives",
+ "env_logger",
"hex",
"hex-literal",
"log",
+ "sp-api",
"tiny-keccak",
]
@@ -1003,7 +1001,7 @@ version = "3.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c"
dependencies = [
- "heck 0.4.0",
+ "heck",
"proc-macro-error",
"proc-macro2",
"quote",
@@ -1019,15 +1017,6 @@ dependencies = [
"os_str_bytes",
]
-[[package]]
-name = "cloudabi"
-version = "0.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
-dependencies = [
- "bitflags",
-]
-
[[package]]
name = "cmake"
version = "0.1.46"
@@ -1039,9 +1028,9 @@ dependencies = [
[[package]]
name = "comfy-table"
-version = "5.0.1"
+version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b103d85ca6e209388771bfb7aa6b68a7aeec4afbf6f0a0264bfbf50360e5212e"
+checksum = "121d8a5b0346092c18a4b2fd6f620d7a06f0eb7ac0a45860939a0884bc579c56"
dependencies = [
"strum",
"strum_macros",
@@ -1139,11 +1128,11 @@ dependencies = [
[[package]]
name = "cranelift-bforest"
-version = "0.82.3"
+version = "0.85.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38faa2a16616c8e78a18d37b4726b98bfd2de192f2fdc8a39ddf568a408a0f75"
+checksum = "899dc8d22f7771e7f887fb8bafa0c0d3ac1dea0c7f2c0ded6e20a855a7a1e890"
dependencies = [
- "cranelift-entity 0.82.3",
+ "cranelift-entity 0.85.0",
]
[[package]]
@@ -1158,24 +1147,25 @@ dependencies = [
"cranelift-entity 0.76.0",
"gimli 0.25.0",
"log",
- "regalloc 0.0.31",
+ "regalloc",
"smallvec",
"target-lexicon",
]
[[package]]
name = "cranelift-codegen"
-version = "0.82.3"
+version = "0.85.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26f192472a3ba23860afd07d2b0217dc628f21fcc72617aa1336d98e1671f33b"
+checksum = "8dbdc03f695cf67e7bc45da57155528274f47390b85060af8107eb304ef167c4"
dependencies = [
- "cranelift-bforest 0.82.3",
- "cranelift-codegen-meta 0.82.3",
- "cranelift-codegen-shared 0.82.3",
- "cranelift-entity 0.82.3",
+ "cranelift-bforest 0.85.0",
+ "cranelift-codegen-meta 0.85.0",
+ "cranelift-codegen-shared 0.85.0",
+ "cranelift-entity 0.85.0",
+ "cranelift-isle",
"gimli 0.26.1",
"log",
- "regalloc 0.0.34",
+ "regalloc2",
"smallvec",
"target-lexicon",
]
@@ -1192,11 +1182,11 @@ dependencies = [
[[package]]
name = "cranelift-codegen-meta"
-version = "0.82.3"
+version = "0.85.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f32ddb89e9b89d3d9b36a5b7d7ea3261c98235a76ac95ba46826b8ec40b1a24"
+checksum = "9ea66cbba3eb7fcb3ec9f42839a6d381bd40cf97780397e7167daf9725d4ffa0"
dependencies = [
- "cranelift-codegen-shared 0.82.3",
+ "cranelift-codegen-shared 0.85.0",
]
[[package]]
@@ -1207,9 +1197,9 @@ checksum = "9dabb5fe66e04d4652e434195b45ae65b5c8172d520247b8f66d8df42b2b45dc"
[[package]]
name = "cranelift-codegen-shared"
-version = "0.82.3"
+version = "0.85.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01fd0d9f288cc1b42d9333b7a776b17e278fc888c28e6a0f09b5573d45a150bc"
+checksum = "712fbebd119a476f59122b4ba51fdce893a66309b5c92bd5506bfb11a0587496"
[[package]]
name = "cranelift-entity"
@@ -1219,9 +1209,9 @@ checksum = "3329733e4d4b8e91c809efcaa4faee80bf66f20164e3dd16d707346bd3494799"
[[package]]
name = "cranelift-entity"
-version = "0.82.3"
+version = "0.85.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e3bfe172b83167604601faf9dc60453e0d0a93415b57a9c4d1a7ae6849185cf"
+checksum = "4cb8b95859c4e14c9e860db78d596a904fdbe9261990233b62bd526346cb56cb"
dependencies = [
"serde",
]
@@ -1240,40 +1230,46 @@ dependencies = [
[[package]]
name = "cranelift-frontend"
-version = "0.82.3"
+version = "0.85.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a006e3e32d80ce0e4ba7f1f9ddf66066d052a8c884a110b91d05404d6ce26dce"
+checksum = "c7b91b19a7d1221a73f190c0e865c12be77a84f661cac89abfd4ab5820142886"
dependencies = [
- "cranelift-codegen 0.82.3",
+ "cranelift-codegen 0.85.0",
"log",
"smallvec",
"target-lexicon",
]
+[[package]]
+name = "cranelift-isle"
+version = "0.85.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86d4f53bc86fb458e59c695c6a95ce8346e6a8377ee7ffc058e3ac08b5f94cb1"
+
[[package]]
name = "cranelift-native"
-version = "0.82.3"
+version = "0.85.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "501241b0cdf903412ec9075385ac9f2b1eb18a89044d1538e97fab603231f70c"
+checksum = "592f035d0ed41214dfeeb37abd536233536a27be6b4c2d39f380cd402f0cff4f"
dependencies = [
- "cranelift-codegen 0.82.3",
+ "cranelift-codegen 0.85.0",
"libc",
"target-lexicon",
]
[[package]]
name = "cranelift-wasm"
-version = "0.82.3"
+version = "0.85.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "16d9e4211bbc3268042a96dd4de5bd979cda22434991d035f5f8eacba987fad2"
+checksum = "295add6bf0b527a8bc50d02e31ff878585d2d2db53cb7e8754d6d82b84480086"
dependencies = [
- "cranelift-codegen 0.82.3",
- "cranelift-entity 0.82.3",
- "cranelift-frontend 0.82.3",
+ "cranelift-codegen 0.85.0",
+ "cranelift-entity 0.85.0",
+ "cranelift-frontend 0.85.0",
"itertools",
"log",
"smallvec",
- "wasmparser 0.83.0",
+ "wasmparser 0.85.0",
"wasmtime-types",
]
@@ -1792,6 +1788,20 @@ dependencies = [
"zeroize",
]
+[[package]]
+name = "ed25519-zebra"
+version = "3.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "403ef3e961ab98f0ba902771d29f842058578bb1ce7e3c59dad5a6a93e784c69"
+dependencies = [
+ "curve25519-dalek 3.0.2",
+ "hex",
+ "rand_core 0.6.2",
+ "sha2 0.9.8",
+ "thiserror",
+ "zeroize",
+]
+
[[package]]
name = "either"
version = "1.6.1"
@@ -1822,7 +1832,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73"
dependencies = [
- "heck 0.4.0",
+ "heck",
"proc-macro2",
"quote",
"syn",
@@ -1889,19 +1899,6 @@ dependencies = [
"syn",
]
-[[package]]
-name = "env_logger"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
-dependencies = [
- "atty",
- "humantime 1.3.0",
- "log",
- "regex",
- "termcolor",
-]
-
[[package]]
name = "env_logger"
version = "0.9.0"
@@ -1909,7 +1906,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
dependencies = [
"atty",
- "humantime 2.1.0",
+ "humantime",
"log",
"regex",
"termcolor",
@@ -1999,11 +1996,11 @@ dependencies = [
[[package]]
name = "file-per-thread-logger"
-version = "0.1.4"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fdbe0d94371f9ce939b555dd342d0686cc4c0cadbcd4b61d70af5ff97eb4126"
+checksum = "21e16290574b39ee41c71aeb90ae960c504ebaf1e2a1c87bd52aa56ed6e1a02f"
dependencies = [
- "env_logger 0.7.1",
+ "env_logger",
"log",
]
@@ -2267,6 +2264,7 @@ dependencies = [
"serde",
"serde_json",
"smallvec",
+ "sp-api",
"sp-arithmetic",
"sp-core",
"sp-core-hashing-proc-macro",
@@ -2436,12 +2434,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
-[[package]]
-name = "fuchsia-cprng"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
-
[[package]]
name = "funty"
version = "2.0.0"
@@ -2570,6 +2562,15 @@ dependencies = [
"slab",
]
+[[package]]
+name = "fxhash"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
+dependencies = [
+ "byteorder",
+]
+
[[package]]
name = "gcc"
version = "0.3.55"
@@ -2733,9 +2734,9 @@ dependencies = [
[[package]]
name = "h2"
-version = "0.3.9"
+version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f072413d126e57991455e0a922b31e4c8ba7c2ffbebf6b78b4f8521397d65cd"
+checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57"
dependencies = [
"bytes",
"fnv",
@@ -2746,7 +2747,7 @@ dependencies = [
"indexmap",
"slab",
"tokio",
- "tokio-util 0.6.7",
+ "tokio-util",
"tracing",
]
@@ -2803,15 +2804,6 @@ dependencies = [
"ahash",
]
-[[package]]
-name = "heck"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac"
-dependencies = [
- "unicode-segmentation",
-]
-
[[package]]
name = "heck"
version = "0.4.0"
@@ -2900,13 +2892,13 @@ dependencies = [
[[package]]
name = "http"
-version = "0.2.3"
+version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747"
+checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
dependencies = [
"bytes",
"fnv",
- "itoa 0.4.8",
+ "itoa 1.0.1",
]
[[package]]
@@ -2932,15 +2924,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440"
-[[package]]
-name = "humantime"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
-dependencies = [
- "quick-error 1.2.3",
-]
-
[[package]]
name = "humantime"
version = "2.1.0"
@@ -2964,7 +2947,7 @@ dependencies = [
"httpdate",
"itoa 0.4.8",
"pin-project-lite 0.2.6",
- "socket2 0.4.4",
+ "socket2",
"tokio",
"tower-service",
"tracing",
@@ -3066,7 +3049,7 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
dependencies = [
- "autocfg 1.0.1",
+ "autocfg",
"hashbrown 0.11.2",
"serde",
]
@@ -3095,6 +3078,12 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec58677acfea8a15352d42fc87d11d63596ade9239e0a7c9352914417515dbe6"
+[[package]]
+name = "io-lifetimes"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24c3f4eff5495aee4c0399d7b6a0dc2b6e81be84242ffbfcf253ebacccc1d0cb"
+
[[package]]
name = "ip_network"
version = "0.4.1"
@@ -3107,7 +3096,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98"
dependencies = [
- "socket2 0.4.4",
+ "socket2",
"widestring",
"winapi",
"winreg",
@@ -3160,9 +3149,9 @@ dependencies = [
[[package]]
name = "jsonrpsee"
-version = "0.14.0"
+version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "11e017217fcd18da0a25296d3693153dd19c8a6aadab330b3595285d075385d1"
+checksum = "8bd0d559d5e679b1ab2f869b486a11182923863b1b3ee8b421763cdd707b783a"
dependencies = [
"jsonrpsee-core",
"jsonrpsee-http-server",
@@ -3175,30 +3164,30 @@ dependencies = [
[[package]]
name = "jsonrpsee-client-transport"
-version = "0.14.0"
+version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce395539a14d3ad4ec1256fde105abd36a2da25d578a291cabe98f45adfdb111"
+checksum = "8752740ecd374bcbf8b69f3e80b0327942df76f793f8d4e60d3355650c31fb74"
dependencies = [
"futures-util",
"http",
"jsonrpsee-core",
"jsonrpsee-types",
- "pin-project 1.0.10",
+ "pin-project",
"rustls-native-certs",
"soketto",
"thiserror",
"tokio",
"tokio-rustls",
- "tokio-util 0.7.1",
+ "tokio-util",
"tracing",
"webpki-roots",
]
[[package]]
name = "jsonrpsee-core"
-version = "0.14.0"
+version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "16efcd4477de857d4a2195a45769b2fe9ebb54f3ef5a4221d3b014a4fe33ec0b"
+checksum = "f3dc3e9cf2ba50b7b1d7d76a667619f82846caa39e8e8daa8a4962d74acaddca"
dependencies = [
"anyhow",
"arrayvec 0.7.2",
@@ -3209,6 +3198,7 @@ dependencies = [
"futures-timer",
"futures-util",
"globset",
+ "http",
"hyper",
"jsonrpsee-types",
"lazy_static",
@@ -3221,14 +3211,15 @@ dependencies = [
"thiserror",
"tokio",
"tracing",
+ "tracing-futures",
"unicase",
]
[[package]]
name = "jsonrpsee-http-server"
-version = "0.14.0"
+version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bdd69efeb3ce2cba767f126872f4eeb4624038a29098e75d77608b2b4345ad03"
+checksum = "03802f0373a38c2420c70b5144742d800b509e2937edc4afb116434f07120117"
dependencies = [
"futures-channel",
"futures-util",
@@ -3239,13 +3230,14 @@ dependencies = [
"serde_json",
"tokio",
"tracing",
+ "tracing-futures",
]
[[package]]
name = "jsonrpsee-proc-macros"
-version = "0.14.0"
+version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "874cf3f6a027cebf36cae767feca9aa2e8a8f799880e49eb5540819fcbd8eada"
+checksum = "bd67957d4280217247588ac86614ead007b301ca2fa9f19c19f880a536f029e3"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -3255,9 +3247,9 @@ dependencies = [
[[package]]
name = "jsonrpsee-types"
-version = "0.14.0"
+version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3bcf76cd316f5d3ad48138085af1f45e2c58c98e02f0779783dbb034d43f7c86"
+checksum = "e290bba767401b646812f608c099b922d8142603c9e73a50fb192d3ac86f4a0d"
dependencies = [
"anyhow",
"beef",
@@ -3269,10 +3261,11 @@ dependencies = [
[[package]]
name = "jsonrpsee-ws-client"
-version = "0.14.0"
+version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee043cb5dd0d51d3eb93432e998d5bae797691a7b10ec4a325e036bcdb48c48a"
+checksum = "6ee5feddd5188e62ac08fcf0e56478138e581509d4730f3f7be9b57dd402a4ff"
dependencies = [
+ "http",
"jsonrpsee-client-transport",
"jsonrpsee-core",
"jsonrpsee-types",
@@ -3280,20 +3273,22 @@ dependencies = [
[[package]]
name = "jsonrpsee-ws-server"
-version = "0.14.0"
+version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bd2e4d266774a671f8def3794255b28eddd09b18d76e0b913fa439f34588c0a"
+checksum = "d488ba74fb369e5ab68926feb75a483458b88e768d44319f37e4ecad283c7325"
dependencies = [
"futures-channel",
"futures-util",
+ "http",
"jsonrpsee-core",
"jsonrpsee-types",
"serde_json",
"soketto",
"tokio",
"tokio-stream",
- "tokio-util 0.7.1",
+ "tokio-util",
"tracing",
+ "tracing-futures",
]
[[package]]
@@ -3325,6 +3320,100 @@ dependencies = [
"tiny-keccak",
]
+[[package]]
+name = "kitchensink-runtime"
+version = "3.0.0-dev"
+dependencies = [
+ "frame-benchmarking",
+ "frame-election-provider-support",
+ "frame-executive",
+ "frame-support",
+ "frame-system",
+ "frame-system-benchmarking",
+ "frame-system-rpc-runtime-api",
+ "frame-try-runtime",
+ "hex-literal",
+ "log",
+ "node-primitives",
+ "pallet-alliance",
+ "pallet-asset-tx-payment",
+ "pallet-assets",
+ "pallet-authority-discovery",
+ "pallet-authorship",
+ "pallet-babe",
+ "pallet-bags-list",
+ "pallet-balances",
+ "pallet-bounties",
+ "pallet-child-bounties",
+ "pallet-collective",
+ "pallet-contracts",
+ "pallet-contracts-primitives",
+ "pallet-contracts-rpc-runtime-api",
+ "pallet-conviction-voting",
+ "pallet-democracy",
+ "pallet-election-provider-multi-phase",
+ "pallet-election-provider-support-benchmarking",
+ "pallet-elections-phragmen",
+ "pallet-gilt",
+ "pallet-grandpa",
+ "pallet-identity",
+ "pallet-im-online",
+ "pallet-indices",
+ "pallet-lottery",
+ "pallet-membership",
+ "pallet-mmr",
+ "pallet-multisig",
+ "pallet-nomination-pools",
+ "pallet-nomination-pools-benchmarking",
+ "pallet-nomination-pools-runtime-api",
+ "pallet-offences",
+ "pallet-offences-benchmarking",
+ "pallet-preimage",
+ "pallet-proxy",
+ "pallet-randomness-collective-flip",
+ "pallet-ranked-collective",
+ "pallet-recovery",
+ "pallet-referenda",
+ "pallet-remark",
+ "pallet-scheduler",
+ "pallet-session",
+ "pallet-session-benchmarking",
+ "pallet-society",
+ "pallet-staking",
+ "pallet-staking-reward-curve",
+ "pallet-state-trie-migration",
+ "pallet-sudo",
+ "pallet-timestamp",
+ "pallet-tips",
+ "pallet-transaction-payment",
+ "pallet-transaction-payment-rpc-runtime-api",
+ "pallet-transaction-storage",
+ "pallet-treasury",
+ "pallet-uniques",
+ "pallet-utility",
+ "pallet-vesting",
+ "pallet-whitelist",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-api",
+ "sp-authority-discovery",
+ "sp-block-builder",
+ "sp-consensus-babe",
+ "sp-core",
+ "sp-inherents",
+ "sp-io",
+ "sp-offchain",
+ "sp-runtime",
+ "sp-sandbox",
+ "sp-session",
+ "sp-staking",
+ "sp-std",
+ "sp-transaction-pool",
+ "sp-version",
+ "static_assertions",
+ "substrate-wasm-builder",
+]
+
[[package]]
name = "kv-log-macro"
version = "1.0.7"
@@ -3393,9 +3482,9 @@ checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a"
[[package]]
name = "libc"
-version = "0.2.121"
+version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
+checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]]
name = "libgit2-sys"
@@ -3437,9 +3526,9 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
[[package]]
name = "libp2p"
-version = "0.45.1"
+version = "0.46.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41726ee8f662563fafba2d2d484b14037cc8ecb8c953fbfc8439d4ce3a0a9029"
+checksum = "81327106887e42d004fbdab1fef93675be2e2e07c1b95fce45e2cc813485611d"
dependencies = [
"bytes",
"futures",
@@ -3448,7 +3537,7 @@ dependencies = [
"instant",
"lazy_static",
"libp2p-autonat",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-deflate",
"libp2p-dns",
"libp2p-floodsub",
@@ -3474,69 +3563,35 @@ dependencies = [
"libp2p-yamux",
"multiaddr",
"parking_lot 0.12.0",
- "pin-project 1.0.10",
+ "pin-project",
"rand 0.7.3",
"smallvec",
]
[[package]]
name = "libp2p-autonat"
-version = "0.4.0"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50de7c1d5c3f040fccb469e8a2d189e068b7627d760dd74ef914071c16bbe905"
+checksum = "4decc51f3573653a9f4ecacb31b1b922dd20c25a6322bb15318ec04287ec46f9"
dependencies = [
"async-trait",
"futures",
"futures-timer",
"instant",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-request-response",
"libp2p-swarm",
"log",
- "prost 0.10.3",
- "prost-build 0.10.4",
- "rand 0.8.4",
-]
-
-[[package]]
-name = "libp2p-core"
-version = "0.32.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db5b02602099fb75cb2d16f9ea860a320d6eb82ce41e95ab680912c454805cd5"
-dependencies = [
- "asn1_der",
- "bs58",
- "ed25519-dalek",
- "either",
- "fnv",
- "futures",
- "futures-timer",
- "instant",
- "lazy_static",
- "log",
- "multiaddr",
- "multihash",
- "multistream-select",
- "parking_lot 0.12.0",
- "pin-project 1.0.10",
- "prost 0.9.0",
- "prost-build 0.9.0",
+ "prost",
+ "prost-build",
"rand 0.8.4",
- "ring",
- "rw-stream-sink 0.2.1",
- "sha2 0.10.2",
- "smallvec",
- "thiserror",
- "unsigned-varint",
- "void",
- "zeroize",
]
[[package]]
name = "libp2p-core"
-version = "0.33.0"
+version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42d46fca305dee6757022e2f5a4f6c023315084d0ed7441c3ab244e76666d979"
+checksum = "fbf9b94cefab7599b2d3dff2f93bee218c6621d68590b23ede4485813cbcece6"
dependencies = [
"asn1_der",
"bs58",
@@ -3553,12 +3608,12 @@ dependencies = [
"multihash",
"multistream-select",
"parking_lot 0.12.0",
- "pin-project 1.0.10",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "pin-project",
+ "prost",
+ "prost-build",
"rand 0.8.4",
"ring",
- "rw-stream-sink 0.3.0",
+ "rw-stream-sink",
"sha2 0.10.2",
"smallvec",
"thiserror",
@@ -3569,24 +3624,24 @@ dependencies = [
[[package]]
name = "libp2p-deflate"
-version = "0.33.0"
+version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86adefc55ea4ed8201149f052fb441210727481dff1fb0b8318460206a79f5fb"
+checksum = "d0183dc2a3da1fbbf85e5b6cf51217f55b14f5daea0c455a9536eef646bfec71"
dependencies = [
"flate2",
"futures",
- "libp2p-core 0.33.0",
+ "libp2p-core",
]
[[package]]
name = "libp2p-dns"
-version = "0.33.0"
+version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbb462ec3a51fab457b4b44ac295e8b0a4b04dc175127e615cf996b1f0f1a268"
+checksum = "6cbf54723250fa5d521383be789bf60efdabe6bacfb443f87da261019a49b4b5"
dependencies = [
"async-std-resolver",
"futures",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"log",
"parking_lot 0.12.0",
"smallvec",
@@ -3595,27 +3650,27 @@ dependencies = [
[[package]]
name = "libp2p-floodsub"
-version = "0.36.0"
+version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a505d0c6f851cbf2919535150198e530825def8bd3757477f13dc3a57f46cbcc"
+checksum = "98a4b6ffd53e355775d24b76f583fdda54b3284806f678499b57913adb94f231"
dependencies = [
"cuckoofilter",
"fnv",
"futures",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-swarm",
"log",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "prost",
+ "prost-build",
"rand 0.7.3",
"smallvec",
]
[[package]]
name = "libp2p-gossipsub"
-version = "0.38.0"
+version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c9be947d8cea8e6b469201314619395826896d2c051053c3723910ba98e68e04"
+checksum = "74b4b888cfbeb1f5551acd3aa1366e01bf88ede26cc3c4645d0d2d004d5ca7b0"
dependencies = [
"asynchronous-codec",
"base64",
@@ -3625,12 +3680,12 @@ dependencies = [
"futures",
"hex_fmt",
"instant",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-swarm",
"log",
"prometheus-client",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "prost",
+ "prost-build",
"rand 0.7.3",
"regex",
"sha2 0.10.2",
@@ -3641,19 +3696,19 @@ dependencies = [
[[package]]
name = "libp2p-identify"
-version = "0.36.1"
+version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b84b53490442d086db1fa5375670c9666e79143dccadef3f7c74a4346899a984"
+checksum = "c50b585518f8efd06f93ac2f976bd672e17cdac794644b3117edd078e96bda06"
dependencies = [
"asynchronous-codec",
"futures",
"futures-timer",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-swarm",
"log",
"lru",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "prost",
+ "prost-build",
"prost-codec",
"smallvec",
"thiserror",
@@ -3662,9 +3717,9 @@ dependencies = [
[[package]]
name = "libp2p-kad"
-version = "0.37.1"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f6b5d4de90fcd35feb65ea6223fd78f3b747a64ca4b65e0813fbe66a27d56aa"
+checksum = "740862893bb5f06ac24acc9d49bdeadc3a5e52e51818a30a25c1f3519da2c851"
dependencies = [
"arrayvec 0.7.2",
"asynchronous-codec",
@@ -3674,11 +3729,11 @@ dependencies = [
"futures",
"futures-timer",
"instant",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-swarm",
"log",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "prost",
+ "prost-build",
"rand 0.7.3",
"sha2 0.10.2",
"smallvec",
@@ -3690,9 +3745,9 @@ dependencies = [
[[package]]
name = "libp2p-mdns"
-version = "0.37.0"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4783f8cf00c7b6c1ff0f1870b4fcf50b042b45533d2e13b6fb464caf447a6951"
+checksum = "66e5e5919509603281033fd16306c61df7a4428ce274b67af5e14b07de5cdcb2"
dependencies = [
"async-io",
"data-encoding",
@@ -3700,22 +3755,22 @@ dependencies = [
"futures",
"if-watch",
"lazy_static",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-swarm",
"log",
"rand 0.8.4",
"smallvec",
- "socket2 0.4.4",
+ "socket2",
"void",
]
[[package]]
name = "libp2p-metrics"
-version = "0.6.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "adc4357140141ba9739eee71b20aa735351c0fc642635b2bffc7f57a6b5c1090"
+checksum = "ef8aff4a1abef42328fbb30b17c853fff9be986dc39af17ee39f9c5f755c5e0c"
dependencies = [
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-gossipsub",
"libp2p-identify",
"libp2p-kad",
@@ -3727,14 +3782,14 @@ dependencies = [
[[package]]
name = "libp2p-mplex"
-version = "0.33.0"
+version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ff9c893f2367631a711301d703c47432af898c9bb8253bea0e2c051a13f7640"
+checksum = "61fd1b20638ec209c5075dfb2e8ce6a7ea4ec3cd3ad7b77f7a477c06d53322e2"
dependencies = [
"asynchronous-codec",
"bytes",
"futures",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"log",
"nohash-hasher",
"parking_lot 0.12.0",
@@ -3745,18 +3800,18 @@ dependencies = [
[[package]]
name = "libp2p-noise"
-version = "0.36.0"
+version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf2cee1dad1c83325bbd182a8e94555778699cec8a9da00086efb7522c4c15ad"
+checksum = "762408cb5d84b49a600422d7f9a42c18012d8da6ebcd570f9a4a4290ba41fb6f"
dependencies = [
"bytes",
"curve25519-dalek 3.0.2",
"futures",
"lazy_static",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"log",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "prost",
+ "prost-build",
"rand 0.8.4",
"sha2 0.10.2",
"snow",
@@ -3767,14 +3822,14 @@ dependencies = [
[[package]]
name = "libp2p-ping"
-version = "0.36.0"
+version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d41516c82fe8dd148ec925eead0c5ec08a0628f7913597e93e126e4dfb4e0787"
+checksum = "100a6934ae1dbf8a693a4e7dd1d730fd60b774dafc45688ed63b554497c6c925"
dependencies = [
"futures",
"futures-timer",
"instant",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-swarm",
"log",
"rand 0.7.3",
@@ -3783,17 +3838,17 @@ dependencies = [
[[package]]
name = "libp2p-plaintext"
-version = "0.33.0"
+version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db007e737adc5d28b2e03223b0210164928ad742591127130796a72aa8eaf54f"
+checksum = "be27bf0820a6238a4e06365b096d428271cce85a129cf16f2fe9eb1610c4df86"
dependencies = [
"asynchronous-codec",
"bytes",
"futures",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"log",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "prost",
+ "prost-build",
"unsigned-varint",
"void",
]
@@ -3806,7 +3861,7 @@ checksum = "0f1a458bbda880107b5b36fcb9b5a1ef0c329685da0e203ed692a8ebe64cc92c"
dependencies = [
"futures",
"log",
- "pin-project 1.0.10",
+ "pin-project",
"rand 0.7.3",
"salsa20",
"sha3 0.9.1",
@@ -3814,9 +3869,9 @@ dependencies = [
[[package]]
name = "libp2p-relay"
-version = "0.9.1"
+version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "624ead3406f64437a0d4567c31bd128a9a0b8226d5f16c074038f5d0fc32f650"
+checksum = "4931547ee0cce03971ccc1733ff05bb0c4349fd89120a39e9861e2bbe18843c3"
dependencies = [
"asynchronous-codec",
"bytes",
@@ -3824,12 +3879,12 @@ dependencies = [
"futures",
"futures-timer",
"instant",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-swarm",
"log",
- "pin-project 1.0.10",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "pin-project",
+ "prost",
+ "prost-build",
"prost-codec",
"rand 0.8.4",
"smallvec",
@@ -3840,20 +3895,20 @@ dependencies = [
[[package]]
name = "libp2p-rendezvous"
-version = "0.6.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c59967ea2db2c7560f641aa58ac05982d42131863fcd3dd6dcf0dd1daf81c60c"
+checksum = "9511c9672ba33284838e349623319c8cad2d18cfad243ae46c6b7e8a2982ea4e"
dependencies = [
"asynchronous-codec",
"bimap",
"futures",
"futures-timer",
"instant",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-swarm",
"log",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "prost",
+ "prost-build",
"rand 0.8.4",
"sha2 0.10.2",
"thiserror",
@@ -3863,15 +3918,15 @@ dependencies = [
[[package]]
name = "libp2p-request-response"
-version = "0.18.0"
+version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b02e0acb725e5a757d77c96b95298fd73a7394fe82ba7b8bbeea510719cbe441"
+checksum = "508a189e2795d892c8f5c1fa1e9e0b1845d32d7b0b249dbf7b05b18811361843"
dependencies = [
"async-trait",
"bytes",
"futures",
"instant",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"libp2p-swarm",
"log",
"rand 0.7.3",
@@ -3881,18 +3936,18 @@ dependencies = [
[[package]]
name = "libp2p-swarm"
-version = "0.36.1"
+version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f4bb21c5abadbf00360c734f16bf87f1712ed4f23cd46148f625d2ddb867346"
+checksum = "95ac5be6c2de2d1ff3f7693fda6faf8a827b1f3e808202277783fea9f527d114"
dependencies = [
"either",
"fnv",
"futures",
"futures-timer",
"instant",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"log",
- "pin-project 1.0.10",
+ "pin-project",
"rand 0.7.3",
"smallvec",
"thiserror",
@@ -3901,9 +3956,9 @@ dependencies = [
[[package]]
name = "libp2p-swarm-derive"
-version = "0.27.1"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "daf2fe8c80b43561355f4d51875273b5b6dfbac37952e8f64b1270769305c9d7"
+checksum = "9f54a64b6957249e0ce782f8abf41d97f69330d02bf229f0672d864f0650cc76"
dependencies = [
"quote",
"syn",
@@ -3911,9 +3966,9 @@ dependencies = [
[[package]]
name = "libp2p-tcp"
-version = "0.33.0"
+version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f4933e38ef21b50698aefc87799c24f2a365c9d3f6cf50471f3f6a0bc410892"
+checksum = "8a6771dc19aa3c65d6af9a8c65222bfc8fcd446630ddca487acd161fa6096f3b"
dependencies = [
"async-io",
"futures",
@@ -3921,32 +3976,32 @@ dependencies = [
"if-watch",
"ipnet",
"libc",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"log",
- "socket2 0.4.4",
+ "socket2",
]
[[package]]
name = "libp2p-uds"
-version = "0.32.0"
+version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24bdab114f7f2701757d6541266e1131b429bbae382008f207f2114ee4222dcb"
+checksum = "d125e3e5f0d58f3c6ac21815b20cf4b6a88b8db9dc26368ea821838f4161fd4d"
dependencies = [
"async-std",
"futures",
- "libp2p-core 0.32.1",
+ "libp2p-core",
"log",
]
[[package]]
name = "libp2p-wasm-ext"
-version = "0.33.0"
+version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f066f2b8b1a1d64793f05da2256e6842ecd0293d6735ca2e9bda89831a1bdc06"
+checksum = "ec894790eec3c1608f8d1a8a0bdf0dbeb79ed4de2dce964222011c2896dfa05a"
dependencies = [
"futures",
"js-sys",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"parity-send-wrapper",
"wasm-bindgen",
"wasm-bindgen-futures",
@@ -3954,18 +4009,18 @@ dependencies = [
[[package]]
name = "libp2p-websocket"
-version = "0.35.0"
+version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39d398fbb29f432c4128fabdaac2ed155c3bcaf1b9bd40eeeb10a471eefacbf5"
+checksum = "9808e57e81be76ff841c106b4c5974fb4d41a233a7bdd2afbf1687ac6def3818"
dependencies = [
"either",
"futures",
"futures-rustls",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"log",
"parking_lot 0.12.0",
"quicksink",
- "rw-stream-sink 0.3.0",
+ "rw-stream-sink",
"soketto",
"url",
"webpki-roots",
@@ -3973,12 +4028,12 @@ dependencies = [
[[package]]
name = "libp2p-yamux"
-version = "0.37.0"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fe653639ad74877c759720febb0cbcbf4caa221adde4eed2d3126ce5c6f381f"
+checksum = "c6dea686217a06072033dc025631932810e2f6ad784e4fafa42e27d311c7a81c"
dependencies = [
"futures",
- "libp2p-core 0.33.0",
+ "libp2p-core",
"parking_lot 0.12.0",
"thiserror",
"yamux",
@@ -4090,6 +4145,12 @@ version = "0.0.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5284f00d480e1c39af34e72f8ad60b94f47007e3481cd3b731c1d67190ddc7b7"
+[[package]]
+name = "linux-raw-sys"
+version = "0.0.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d"
+
[[package]]
name = "lite-json"
version = "0.1.3"
@@ -4280,7 +4341,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
dependencies = [
- "autocfg 1.0.1",
+ "autocfg",
]
[[package]]
@@ -4325,30 +4386,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
dependencies = [
"adler",
- "autocfg 1.0.1",
+ "autocfg",
]
[[package]]
name = "mio"
-version = "0.8.0"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba272f85fa0b41fc91872be579b3bbe0f56b792aa361a380eb669469f68dafb2"
+checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
dependencies = [
"libc",
"log",
- "miow",
- "ntapi",
- "winapi",
-]
-
-[[package]]
-name = "miow"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
-dependencies = [
- "socket2 0.3.19",
- "winapi",
+ "wasi 0.11.0+wasi-snapshot-preview1",
+ "windows-sys 0.36.1",
]
[[package]]
@@ -4432,7 +4482,7 @@ dependencies = [
"bytes",
"futures",
"log",
- "pin-project 1.0.10",
+ "pin-project",
"smallvec",
"unsigned-varint",
]
@@ -4576,12 +4626,12 @@ dependencies = [
"futures",
"hash-db",
"hex",
+ "kitchensink-runtime",
"kvdb",
"kvdb-rocksdb",
"lazy_static",
"log",
"node-primitives",
- "node-runtime",
"node-testing",
"parity-db",
"parity-util-mem",
@@ -4618,13 +4668,13 @@ dependencies = [
"futures",
"hex-literal",
"jsonrpsee",
+ "kitchensink-runtime",
"log",
"nix 0.23.1",
"node-executor",
"node-inspect",
"node-primitives",
"node-rpc",
- "node-runtime",
"pallet-asset-tx-payment",
"pallet-balances",
"pallet-im-online",
@@ -4651,6 +4701,7 @@ dependencies = [
"sc-finality-grandpa",
"sc-keystore",
"sc-network",
+ "sc-network-common",
"sc-rpc",
"sc-service",
"sc-service-test",
@@ -4696,12 +4747,13 @@ dependencies = [
"frame-support",
"frame-system",
"futures",
+ "kitchensink-runtime",
"node-primitives",
- "node-runtime",
"node-testing",
"pallet-balances",
"pallet-contracts",
"pallet-im-online",
+ "pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-treasury",
@@ -4780,106 +4832,13 @@ dependencies = [
"substrate-state-trie-migration-rpc",
]
-[[package]]
-name = "node-runtime"
-version = "3.0.0-dev"
-dependencies = [
- "frame-benchmarking",
- "frame-election-provider-support",
- "frame-executive",
- "frame-support",
- "frame-system",
- "frame-system-benchmarking",
- "frame-system-rpc-runtime-api",
- "frame-try-runtime",
- "hex-literal",
- "log",
- "node-primitives",
- "pallet-alliance",
- "pallet-asset-tx-payment",
- "pallet-assets",
- "pallet-authority-discovery",
- "pallet-authorship",
- "pallet-babe",
- "pallet-bags-list",
- "pallet-balances",
- "pallet-bounties",
- "pallet-child-bounties",
- "pallet-collective",
- "pallet-contracts",
- "pallet-contracts-primitives",
- "pallet-contracts-rpc-runtime-api",
- "pallet-conviction-voting",
- "pallet-democracy",
- "pallet-election-provider-multi-phase",
- "pallet-election-provider-support-benchmarking",
- "pallet-elections-phragmen",
- "pallet-gilt",
- "pallet-grandpa",
- "pallet-identity",
- "pallet-im-online",
- "pallet-indices",
- "pallet-lottery",
- "pallet-membership",
- "pallet-mmr",
- "pallet-multisig",
- "pallet-nomination-pools",
- "pallet-nomination-pools-benchmarking",
- "pallet-offences",
- "pallet-offences-benchmarking",
- "pallet-preimage",
- "pallet-proxy",
- "pallet-randomness-collective-flip",
- "pallet-ranked-collective",
- "pallet-recovery",
- "pallet-referenda",
- "pallet-remark",
- "pallet-scheduler",
- "pallet-session",
- "pallet-session-benchmarking",
- "pallet-society",
- "pallet-staking",
- "pallet-staking-reward-curve",
- "pallet-state-trie-migration",
- "pallet-sudo",
- "pallet-timestamp",
- "pallet-tips",
- "pallet-transaction-payment",
- "pallet-transaction-payment-rpc-runtime-api",
- "pallet-transaction-storage",
- "pallet-treasury",
- "pallet-uniques",
- "pallet-utility",
- "pallet-vesting",
- "pallet-whitelist",
- "parity-scale-codec",
- "scale-info",
- "sp-api",
- "sp-authority-discovery",
- "sp-block-builder",
- "sp-consensus-babe",
- "sp-core",
- "sp-inherents",
- "sp-io",
- "sp-offchain",
- "sp-runtime",
- "sp-sandbox",
- "sp-session",
- "sp-staking",
- "sp-std",
- "sp-transaction-pool",
- "sp-version",
- "static_assertions",
- "substrate-wasm-builder",
-]
-
[[package]]
name = "node-runtime-generate-bags"
version = "3.0.0"
dependencies = [
"clap 3.1.18",
"generate-bags",
- "node-runtime",
+ "kitchensink-runtime",
]
[[package]]
@@ -4968,10 +4927,10 @@ dependencies = [
"frame-system",
"fs_extra",
"futures",
+ "kitchensink-runtime",
"log",
"node-executor",
"node-primitives",
- "node-runtime",
"pallet-asset-tx-payment",
"pallet-transaction-payment",
"parity-scale-codec",
@@ -5018,22 +4977,13 @@ dependencies = [
"version_check",
]
-[[package]]
-name = "ntapi"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
-dependencies = [
- "winapi",
-]
-
[[package]]
name = "num-bigint"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"
dependencies = [
- "autocfg 1.0.1",
+ "autocfg",
"num-integer",
"num-traits",
]
@@ -5063,7 +5013,7 @@ version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
dependencies = [
- "autocfg 1.0.1",
+ "autocfg",
"num-traits",
]
@@ -5073,7 +5023,7 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
dependencies = [
- "autocfg 1.0.1",
+ "autocfg",
"num-bigint",
"num-integer",
"num-traits",
@@ -5085,18 +5035,18 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a"
dependencies = [
- "autocfg 1.0.1",
+ "autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-traits"
-version = "0.2.14"
+version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
+checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
- "autocfg 1.0.1",
+ "autocfg",
"libm",
]
@@ -5116,8 +5066,6 @@ version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9"
dependencies = [
- "crc32fast",
- "indexmap",
"memchr",
]
@@ -5135,9 +5083,9 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.10.0"
+version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
+checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
[[package]]
name = "oorandom"
@@ -5505,11 +5453,12 @@ version = "4.0.0-dev"
dependencies = [
"assert_matches",
"bitflags",
- "env_logger 0.9.0",
+ "env_logger",
"frame-benchmarking",
"frame-support",
"frame-system",
"hex-literal",
+ "impl-trait-for-tuples",
"log",
"pallet-balances",
"pallet-contracts-primitives",
@@ -5678,6 +5627,7 @@ dependencies = [
"sp-npos-elections",
"sp-runtime",
"sp-std",
+ "sp-tracing",
"substrate-test-utils",
]
@@ -5869,11 +5819,12 @@ name = "pallet-mmr"
version = "4.0.0-dev"
dependencies = [
"ckb-merkle-mountain-range",
- "env_logger 0.9.0",
+ "env_logger",
"frame-benchmarking",
"frame-support",
"frame-system",
"hex-literal",
+ "itertools",
"parity-scale-codec",
"scale-info",
"sp-core",
@@ -5985,6 +5936,15 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "pallet-nomination-pools-runtime-api"
+version = "1.0.0-dev"
+dependencies = [
+ "parity-scale-codec",
+ "sp-api",
+ "sp-std",
+]
+
[[package]]
name = "pallet-nomination-pools-test-staking"
version = "1.0.0"
@@ -6580,6 +6540,7 @@ dependencies = [
"arrayvec 0.7.2",
"bitvec",
"byte-slice-cast",
+ "bytes",
"impl-trait-for-tuples",
"parity-scale-codec-derive",
"serde",
@@ -6696,7 +6657,7 @@ dependencies = [
"libc",
"redox_syscall",
"smallvec",
- "windows-sys",
+ "windows-sys 0.32.0",
]
[[package]]
@@ -6807,33 +6768,13 @@ dependencies = [
"indexmap",
]
-[[package]]
-name = "pin-project"
-version = "0.4.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9615c18d31137579e9ff063499264ddc1278e7b1982757ebc111028c4d1dc909"
-dependencies = [
- "pin-project-internal 0.4.29",
-]
-
[[package]]
name = "pin-project"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e"
dependencies = [
- "pin-project-internal 1.0.10",
-]
-
-[[package]]
-name = "pin-project-internal"
-version = "0.4.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "044964427019eed9d49d9d5bbce6047ef18f37100ea400912a9fa4a3523ab12a"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "pin-project-internal",
]
[[package]]
@@ -7087,42 +7028,12 @@ dependencies = [
[[package]]
name = "prost"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001"
-dependencies = [
- "bytes",
- "prost-derive 0.9.0",
-]
-
-[[package]]
-name = "prost"
-version = "0.10.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc03e116981ff7d8da8e5c220e374587b98d294af7ba7dd7fda761158f00086f"
-dependencies = [
- "bytes",
- "prost-derive 0.10.1",
-]
-
-[[package]]
-name = "prost-build"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5"
-dependencies = [
- "bytes",
- "heck 0.3.2",
- "itertools",
- "lazy_static",
- "log",
- "multimap",
- "petgraph",
- "prost 0.9.0",
- "prost-types 0.9.0",
- "regex",
- "tempfile",
- "which",
+version = "0.10.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc03e116981ff7d8da8e5c220e374587b98d294af7ba7dd7fda761158f00086f"
+dependencies = [
+ "bytes",
+ "prost-derive",
]
[[package]]
@@ -7134,14 +7045,14 @@ dependencies = [
"bytes",
"cfg-if 1.0.0",
"cmake",
- "heck 0.4.0",
+ "heck",
"itertools",
"lazy_static",
"log",
"multimap",
"petgraph",
- "prost 0.10.3",
- "prost-types 0.10.1",
+ "prost",
+ "prost-types",
"regex",
"tempfile",
"which",
@@ -7155,24 +7066,11 @@ checksum = "00af1e92c33b4813cc79fda3f2dbf56af5169709be0202df730e9ebc3e4cd007"
dependencies = [
"asynchronous-codec",
"bytes",
- "prost 0.10.3",
+ "prost",
"thiserror",
"unsigned-varint",
]
-[[package]]
-name = "prost-derive"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe"
-dependencies = [
- "anyhow",
- "itertools",
- "proc-macro2",
- "quote",
- "syn",
-]
-
[[package]]
name = "prost-derive"
version = "0.10.1"
@@ -7186,16 +7084,6 @@ dependencies = [
"syn",
]
-[[package]]
-name = "prost-types"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a"
-dependencies = [
- "bytes",
- "prost 0.9.0",
-]
-
[[package]]
name = "prost-types"
version = "0.10.1"
@@ -7203,7 +7091,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68"
dependencies = [
"bytes",
- "prost 0.10.3",
+ "prost",
]
[[package]]
@@ -7282,25 +7170,6 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
-[[package]]
-name = "rand"
-version = "0.6.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
-dependencies = [
- "autocfg 0.1.7",
- "libc",
- "rand_chacha 0.1.1",
- "rand_core 0.4.2",
- "rand_hc 0.1.0",
- "rand_isaac",
- "rand_jitter",
- "rand_os",
- "rand_pcg 0.1.2",
- "rand_xorshift",
- "winapi",
-]
-
[[package]]
name = "rand"
version = "0.7.3"
@@ -7327,16 +7196,6 @@ dependencies = [
"rand_hc 0.3.0",
]
-[[package]]
-name = "rand_chacha"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
-dependencies = [
- "autocfg 0.1.7",
- "rand_core 0.3.1",
-]
-
[[package]]
name = "rand_chacha"
version = "0.2.2"
@@ -7357,21 +7216,6 @@ dependencies = [
"rand_core 0.6.2",
]
-[[package]]
-name = "rand_core"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
-dependencies = [
- "rand_core 0.4.2",
-]
-
-[[package]]
-name = "rand_core"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
-
[[package]]
name = "rand_core"
version = "0.5.1"
@@ -7400,15 +7244,6 @@ dependencies = [
"rand 0.8.4",
]
-[[package]]
-name = "rand_hc"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
-dependencies = [
- "rand_core 0.3.1",
-]
-
[[package]]
name = "rand_hc"
version = "0.2.0"
@@ -7427,50 +7262,6 @@ dependencies = [
"rand_core 0.6.2",
]
-[[package]]
-name = "rand_isaac"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
-dependencies = [
- "rand_core 0.3.1",
-]
-
-[[package]]
-name = "rand_jitter"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
-dependencies = [
- "libc",
- "rand_core 0.4.2",
- "winapi",
-]
-
-[[package]]
-name = "rand_os"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
-dependencies = [
- "cloudabi",
- "fuchsia-cprng",
- "libc",
- "rand_core 0.4.2",
- "rdrand",
- "winapi",
-]
-
-[[package]]
-name = "rand_pcg"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
-dependencies = [
- "autocfg 0.1.7",
- "rand_core 0.4.2",
-]
-
[[package]]
name = "rand_pcg"
version = "0.2.1"
@@ -7489,15 +7280,6 @@ dependencies = [
"rand_core 0.6.2",
]
-[[package]]
-name = "rand_xorshift"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
-dependencies = [
- "rand_core 0.3.1",
-]
-
[[package]]
name = "rawpointer"
version = "0.2.1"
@@ -7510,7 +7292,7 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674"
dependencies = [
- "autocfg 1.0.1",
+ "autocfg",
"crossbeam-deque",
"either",
"rayon-core",
@@ -7529,15 +7311,6 @@ dependencies = [
"num_cpus",
]
-[[package]]
-name = "rdrand"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
-dependencies = [
- "rand_core 0.3.1",
-]
-
[[package]]
name = "redox_syscall"
version = "0.2.10"
@@ -7589,13 +7362,14 @@ dependencies = [
]
[[package]]
-name = "regalloc"
-version = "0.0.34"
+name = "regalloc2"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62446b1d3ebf980bdc68837700af1d77b37bc430e524bf95319c6eada2a4cc02"
+checksum = "0d37148700dbb38f994cd99a1431613057f37ed934d7e4d799b7ab758c482461"
dependencies = [
+ "fxhash",
"log",
- "rustc-hash",
+ "slice-group-by",
"smallvec",
]
@@ -7654,7 +7428,7 @@ dependencies = [
name = "remote-externalities"
version = "0.10.0-dev"
dependencies = [
- "env_logger 0.9.0",
+ "env_logger",
"frame-support",
"jsonrpsee",
"log",
@@ -7697,12 +7471,6 @@ dependencies = [
"quick-error 1.2.3",
]
-[[package]]
-name = "retain_mut"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "448296241d034b96c11173591deaa1302f2c17b56092106c1f92c1bc0183a8c9"
-
[[package]]
name = "rfc6979"
version = "0.1.0"
@@ -7766,9 +7534,9 @@ dependencies = [
[[package]]
name = "rpassword"
-version = "5.0.1"
+version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffc936cf8a7ea60c58f030fd36a612a48f440610214dc54bc36431f9ea0c3efb"
+checksum = "26b763cb66df1c928432cc35053f8bd4cec3335d8559fc16010017d16b3c1680"
dependencies = [
"libc",
"winapi",
@@ -7827,18 +7595,32 @@ dependencies = [
[[package]]
name = "rustix"
-version = "0.33.5"
+version = "0.33.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03627528abcc4a365554d32a9f3bbf67f7694c102cfeda792dc86a2d6057cc85"
+checksum = "938a344304321a9da4973b9ff4f9f8db9caf4597dfd9dda6a60b523340a0fff0"
dependencies = [
"bitflags",
"errno",
- "io-lifetimes",
+ "io-lifetimes 0.5.3",
"libc",
- "linux-raw-sys",
+ "linux-raw-sys 0.0.42",
"winapi",
]
+[[package]]
+name = "rustix"
+version = "0.35.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef258c11e17f5c01979a10543a30a4e12faef6aab217a74266e747eefa3aed88"
+dependencies = [
+ "bitflags",
+ "errno",
+ "io-lifetimes 0.7.2",
+ "libc",
+ "linux-raw-sys 0.0.46",
+ "windows-sys 0.36.1",
+]
+
[[package]]
name = "rustls"
version = "0.20.2"
@@ -7878,17 +7660,6 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
-[[package]]
-name = "rw-stream-sink"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020"
-dependencies = [
- "futures",
- "pin-project 0.4.29",
- "static_assertions",
-]
-
[[package]]
name = "rw-stream-sink"
version = "0.3.0"
@@ -7896,7 +7667,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04"
dependencies = [
"futures",
- "pin-project 1.0.10",
+ "pin-project",
"static_assertions",
]
@@ -7947,19 +7718,19 @@ dependencies = [
name = "sc-authority-discovery"
version = "0.10.0-dev"
dependencies = [
- "async-trait",
"futures",
"futures-timer",
"ip_network",
"libp2p",
"log",
"parity-scale-codec",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "prost",
+ "prost-build",
"quickcheck",
"rand 0.7.3",
"sc-client-api",
"sc-network",
+ "sc-network-common",
"sp-api",
"sp-authority-discovery",
"sp-blockchain",
@@ -8213,7 +7984,6 @@ dependencies = [
"parking_lot 0.12.0",
"rand 0.7.3",
"rand_chacha 0.2.2",
- "retain_mut",
"sc-block-builder",
"sc-client-api",
"sc-consensus",
@@ -8388,7 +8158,7 @@ name = "sc-executor"
version = "0.10.0-dev"
dependencies = [
"criterion",
- "env_logger 0.9.0",
+ "env_logger",
"hex-literal",
"lazy_static",
"lru",
@@ -8433,7 +8203,6 @@ dependencies = [
"sc-allocator",
"sp-maybe-compressed-blob",
"sp-sandbox",
- "sp-serializer",
"sp-wasm-interface",
"thiserror",
"wasm-instrument",
@@ -8462,9 +8231,11 @@ dependencies = [
"cfg-if 1.0.0",
"libc",
"log",
+ "once_cell",
"parity-scale-codec",
"parity-wasm 0.42.2",
"paste 1.0.6",
+ "rustix 0.35.6",
"sc-allocator",
"sc-executor-common",
"sc-runtime-test",
@@ -8500,6 +8271,7 @@ dependencies = [
"sc-consensus",
"sc-keystore",
"sc-network",
+ "sc-network-common",
"sc-network-gossip",
"sc-network-test",
"sc-telemetry",
@@ -8559,7 +8331,7 @@ dependencies = [
"log",
"parity-util-mem",
"sc-client-api",
- "sc-network",
+ "sc-network-common",
"sc-transaction-pool-api",
"sp-blockchain",
"sp-runtime",
@@ -8605,9 +8377,9 @@ dependencies = [
"lru",
"parity-scale-codec",
"parking_lot 0.12.0",
- "pin-project 1.0.10",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "pin-project",
+ "prost",
+ "prost-build",
"rand 0.7.3",
"sc-block-builder",
"sc-client-api",
@@ -8624,7 +8396,6 @@ dependencies = [
"sp-blockchain",
"sp-consensus",
"sp-core",
- "sp-finality-grandpa",
"sp-runtime",
"sp-test-primitives",
"sp-tracing",
@@ -8642,12 +8413,20 @@ dependencies = [
name = "sc-network-common"
version = "0.10.0-dev"
dependencies = [
+ "async-trait",
+ "bitflags",
+ "bytes",
"futures",
"libp2p",
"parity-scale-codec",
- "prost-build 0.10.4",
+ "prost-build",
+ "sc-consensus",
"sc-peerset",
"smallvec",
+ "sp-consensus",
+ "sp-finality-grandpa",
+ "sp-runtime",
+ "thiserror",
]
[[package]]
@@ -8663,6 +8442,7 @@ dependencies = [
"lru",
"quickcheck",
"sc-network",
+ "sc-network-common",
"sp-runtime",
"substrate-prometheus-endpoint",
"substrate-test-runtime-client",
@@ -8674,11 +8454,12 @@ name = "sc-network-light"
version = "0.10.0-dev"
dependencies = [
"futures",
+ "hex",
"libp2p",
"log",
"parity-scale-codec",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "prost",
+ "prost-build",
"sc-client-api",
"sc-network-common",
"sc-peerset",
@@ -8692,16 +8473,15 @@ dependencies = [
name = "sc-network-sync"
version = "0.10.0-dev"
dependencies = [
- "bitflags",
- "either",
"fork-tree",
"futures",
+ "hex",
"libp2p",
"log",
"lru",
"parity-scale-codec",
- "prost 0.10.3",
- "prost-build 0.10.4",
+ "prost",
+ "prost-build",
"quickcheck",
"sc-block-builder",
"sc-client-api",
@@ -8738,6 +8518,8 @@ dependencies = [
"sc-consensus",
"sc-network",
"sc-network-common",
+ "sc-network-light",
+ "sc-network-sync",
"sc-service",
"sp-blockchain",
"sp-consensus",
@@ -8770,6 +8552,7 @@ dependencies = [
"sc-client-api",
"sc-client-db",
"sc-network",
+ "sc-network-common",
"sc-transaction-pool",
"sc-transaction-pool-api",
"sc-utils",
@@ -8811,7 +8594,7 @@ name = "sc-rpc"
version = "4.0.0-dev"
dependencies = [
"assert_matches",
- "env_logger 0.9.0",
+ "env_logger",
"futures",
"hash-db",
"jsonrpsee",
@@ -8908,7 +8691,7 @@ dependencies = [
"parity-scale-codec",
"parity-util-mem",
"parking_lot 0.12.0",
- "pin-project 1.0.10",
+ "pin-project",
"rand 0.7.3",
"sc-block-builder",
"sc-chain-spec",
@@ -8920,6 +8703,8 @@ dependencies = [
"sc-keystore",
"sc-network",
"sc-network-common",
+ "sc-network-light",
+ "sc-network-sync",
"sc-offchain",
"sc-rpc",
"sc-rpc-server",
@@ -8976,6 +8761,7 @@ dependencies = [
"sc-consensus",
"sc-executor",
"sc-network",
+ "sc-network-common",
"sc-service",
"sc-transaction-pool-api",
"sp-api",
@@ -9053,7 +8839,7 @@ dependencies = [
"libp2p",
"log",
"parking_lot 0.12.0",
- "pin-project 1.0.10",
+ "pin-project",
"rand 0.7.3",
"serde",
"serde_json",
@@ -9116,7 +8902,6 @@ dependencies = [
"parity-scale-codec",
"parity-util-mem",
"parking_lot 0.12.0",
- "retain_mut",
"sc-block-builder",
"sc-client-api",
"sc-transaction-pool-api",
@@ -9251,19 +9036,18 @@ dependencies = [
[[package]]
name = "secp256k1"
-version = "0.21.2"
+version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab7883017d5b21f011ef8040ea9c6c7ac90834c0df26a69e4c0b06276151f125"
+checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff"
dependencies = [
- "rand 0.6.5",
"secp256k1-sys",
]
[[package]]
name = "secp256k1-sys"
-version = "0.4.2"
+version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036"
+checksum = "7058dc8eaf3f2810d7828680320acda0b25a288f6d288e19278e249bbf74226b"
dependencies = [
"cc",
]
@@ -9537,6 +9321,12 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
+[[package]]
+name = "slice-group-by"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec"
+
[[package]]
name = "smallvec"
version = "1.8.0"
@@ -9566,17 +9356,6 @@ dependencies = [
"subtle",
]
-[[package]]
-name = "socket2"
-version = "0.3.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"
-dependencies = [
- "cfg-if 1.0.0",
- "libc",
- "winapi",
-]
-
[[package]]
name = "socket2"
version = "0.4.4"
@@ -9859,7 +9638,7 @@ dependencies = [
"byteorder",
"criterion",
"dyn-clonable",
- "ed25519-dalek",
+ "ed25519-zebra",
"futures",
"hash-db",
"hash256-std-hasher",
@@ -9984,6 +9763,7 @@ dependencies = [
name = "sp-io"
version = "6.0.0"
dependencies = [
+ "bytes",
"futures",
"hash-db",
"libsecp256k1",
@@ -10142,6 +9922,7 @@ dependencies = [
name = "sp-runtime-interface"
version = "6.0.0"
dependencies = [
+ "bytes",
"impl-trait-for-tuples",
"parity-scale-codec",
"primitive-types",
@@ -10191,6 +9972,7 @@ dependencies = [
name = "sp-runtime-interface-test-wasm"
version = "2.0.0"
dependencies = [
+ "bytes",
"sp-core",
"sp-io",
"sp-runtime-interface",
@@ -10483,20 +10265,20 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "strum"
-version = "0.23.0"
+version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb"
+checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
dependencies = [
"strum_macros",
]
[[package]]
name = "strum_macros"
-version = "0.23.1"
+version = "0.24.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38"
+checksum = "4faebde00e8ff94316c01800f9054fd2ba77d30d9e922541913051d1d978918b"
dependencies = [
- "heck 0.3.2",
+ "heck",
"proc-macro2",
"quote",
"rustversion",
@@ -10646,6 +10428,7 @@ dependencies = [
name = "substrate-test-runtime"
version = "2.0.0"
dependencies = [
+ "beefy-merkle-tree",
"beefy-primitives",
"cfg-if 1.0.0",
"frame-support",
@@ -11002,7 +10785,7 @@ dependencies = [
"parking_lot 0.12.0",
"pin-project-lite 0.2.6",
"signal-hook-registry",
- "socket2 0.4.4",
+ "socket2",
"tokio-macros",
"winapi",
]
@@ -11053,20 +10836,6 @@ dependencies = [
"tokio-stream",
]
-[[package]]
-name = "tokio-util"
-version = "0.6.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592"
-dependencies = [
- "bytes",
- "futures-core",
- "futures-sink",
- "log",
- "pin-project-lite 0.2.6",
- "tokio",
-]
-
[[package]]
name = "tokio-util"
version = "0.7.1"
@@ -11079,6 +10848,7 @@ dependencies = [
"futures-sink",
"pin-project-lite 0.2.6",
"tokio",
+ "tracing",
]
[[package]]
@@ -11098,9 +10868,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
[[package]]
name = "tracing"
-version = "0.1.29"
+version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105"
+checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
dependencies = [
"cfg-if 1.0.0",
"log",
@@ -11111,9 +10881,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
-version = "0.1.18"
+version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e"
+checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2"
dependencies = [
"proc-macro2",
"quote",
@@ -11122,11 +10892,11 @@ dependencies = [
[[package]]
name = "tracing-core"
-version = "0.1.26"
+version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f"
+checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7"
dependencies = [
- "lazy_static",
+ "once_cell",
"valuable",
]
@@ -11136,7 +10906,7 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
dependencies = [
- "pin-project 1.0.10",
+ "pin-project",
"tracing",
]
@@ -11146,10 +10916,8 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
dependencies = [
- "ahash",
"lazy_static",
"log",
- "lru",
"tracing-core",
]
@@ -11404,12 +11172,6 @@ dependencies = [
"tinyvec",
]
-[[package]]
-name = "unicode-segmentation"
-version = "1.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
-
[[package]]
name = "unicode-width"
version = "0.1.8"
@@ -11550,6 +11312,12 @@ version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
+[[package]]
+name = "wasi"
+version = "0.11.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
+
[[package]]
name = "wasm-bindgen"
version = "0.2.77"
@@ -11898,15 +11666,18 @@ checksum = "52144d4c78e5cf8b055ceab8e5fa22814ce4315d6002ad32cfd914f37c12fd65"
[[package]]
name = "wasmparser"
-version = "0.83.0"
+version = "0.85.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a"
+checksum = "570460c58b21e9150d2df0eaaedbb7816c34bcec009ae0dcc976e40ba81463e7"
+dependencies = [
+ "indexmap",
+]
[[package]]
name = "wasmtime"
-version = "0.35.3"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21ffb4705016d5ca91e18a72ed6822dab50e6d5ddd7045461b17ef19071cdef1"
+checksum = "c842f9c8e190fe01300fc8d715e9368c775670fb9856247c67abffdb5236d6db"
dependencies = [
"anyhow",
"backtrace",
@@ -11916,7 +11687,7 @@ dependencies = [
"lazy_static",
"libc",
"log",
- "object 0.27.1",
+ "object 0.28.3",
"once_cell",
"paste 1.0.6",
"psm",
@@ -11924,7 +11695,7 @@ dependencies = [
"region 2.2.0",
"serde",
"target-lexicon",
- "wasmparser 0.83.0",
+ "wasmparser 0.85.0",
"wasmtime-cache",
"wasmtime-cranelift",
"wasmtime-environ",
@@ -11935,9 +11706,9 @@ dependencies = [
[[package]]
name = "wasmtime-cache"
-version = "0.35.3"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85c6ab24291fa7cb3a181f5669f6c72599b7ef781669759b45c7828c5999d0c0"
+checksum = "cce2aa752e864a33eef2a6629edc59554e75f0bc1719431dac5e49eed516af69"
dependencies = [
"anyhow",
"base64",
@@ -11945,7 +11716,7 @@ dependencies = [
"directories-next",
"file-per-thread-logger",
"log",
- "rustix",
+ "rustix 0.33.7",
"serde",
"sha2 0.9.8",
"toml",
@@ -11955,51 +11726,51 @@ dependencies = [
[[package]]
name = "wasmtime-cranelift"
-version = "0.35.3"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f04c810078a491b7bc4866ebe045f714d2b95e6b539e1f64009a4a7606be11de"
+checksum = "922361eb8c03cea8909bc922471202f6c6bc2f0c682fac2fe473740441c86b3b"
dependencies = [
"anyhow",
- "cranelift-codegen 0.82.3",
- "cranelift-entity 0.82.3",
- "cranelift-frontend 0.82.3",
+ "cranelift-codegen 0.85.0",
+ "cranelift-entity 0.85.0",
+ "cranelift-frontend 0.85.0",
"cranelift-native",
"cranelift-wasm",
"gimli 0.26.1",
"log",
"more-asserts",
- "object 0.27.1",
+ "object 0.28.3",
"target-lexicon",
"thiserror",
- "wasmparser 0.83.0",
+ "wasmparser 0.85.0",
"wasmtime-environ",
]
[[package]]
name = "wasmtime-environ"
-version = "0.35.3"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61448266ea164b1ac406363cdcfac81c7c44db4d94c7a81c8620ac6c5c6cdf59"
+checksum = "e602f1120fc40a3f016f1f69d08c86cfeff7b867bed1462901953e6871f85167"
dependencies = [
"anyhow",
- "cranelift-entity 0.82.3",
+ "cranelift-entity 0.85.0",
"gimli 0.26.1",
"indexmap",
"log",
"more-asserts",
- "object 0.27.1",
+ "object 0.28.3",
"serde",
"target-lexicon",
"thiserror",
- "wasmparser 0.83.0",
+ "wasmparser 0.85.0",
"wasmtime-types",
]
[[package]]
name = "wasmtime-jit"
-version = "0.35.3"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "156b4623c6b0d4b8c24afb846c20525922f538ef464cc024abab7ea8de2109a2"
+checksum = "49af1445759a8e797a92f27dd0983c155615648263052e0b80d69e7d223896b7"
dependencies = [
"addr2line",
"anyhow",
@@ -12008,10 +11779,10 @@ dependencies = [
"cpp_demangle",
"gimli 0.26.1",
"log",
- "object 0.27.1",
+ "object 0.28.3",
"region 2.2.0",
"rustc-demangle",
- "rustix",
+ "rustix 0.33.7",
"serde",
"target-lexicon",
"thiserror",
@@ -12023,20 +11794,20 @@ dependencies = [
[[package]]
name = "wasmtime-jit-debug"
-version = "0.35.3"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d5dc31f811760a6c76b2672c404866fd19b75e5fb3b0075a3e377a6846490654"
+checksum = "e6d5dd480cc6dc0a401653e45b79796a3317f8228990d84bc2271bdaf0810071"
dependencies = [
"lazy_static",
- "object 0.27.1",
- "rustix",
+ "object 0.28.3",
+ "rustix 0.33.7",
]
[[package]]
name = "wasmtime-runtime"
-version = "0.35.3"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f907beaff69d4d920fa4688411ee4cc75c0f01859e424677f9e426e2ef749864"
+checksum = "e875bcd02d1ecfc7d099dd58354d55d73467652eb2b103ff470fe3aecb7d0381"
dependencies = [
"anyhow",
"backtrace",
@@ -12051,7 +11822,7 @@ dependencies = [
"more-asserts",
"rand 0.8.4",
"region 2.2.0",
- "rustix",
+ "rustix 0.33.7",
"thiserror",
"wasmtime-environ",
"wasmtime-jit-debug",
@@ -12060,14 +11831,14 @@ dependencies = [
[[package]]
name = "wasmtime-types"
-version = "0.35.3"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "514ef0e5fd197b9609dc9eb74beba0c84d5a12b2417cbae55534633329ba4852"
+checksum = "8fd63a19ba61ac7448add4dc1fecb8d78304812af2a52dad04b89f887791b156"
dependencies = [
- "cranelift-entity 0.82.3",
+ "cranelift-entity 0.85.0",
"serde",
"thiserror",
- "wasmparser 0.83.0",
+ "wasmparser 0.85.0",
]
[[package]]
@@ -12199,6 +11970,19 @@ dependencies = [
"windows_x86_64_msvc 0.32.0",
]
+[[package]]
+name = "windows-sys"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
+dependencies = [
+ "windows_aarch64_msvc 0.36.1",
+ "windows_i686_gnu 0.36.1",
+ "windows_i686_msvc 0.36.1",
+ "windows_x86_64_gnu 0.36.1",
+ "windows_x86_64_msvc 0.36.1",
+]
+
[[package]]
name = "windows_aarch64_msvc"
version = "0.29.0"
@@ -12211,6 +11995,12 @@ version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5"
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
+
[[package]]
name = "windows_i686_gnu"
version = "0.29.0"
@@ -12223,6 +12013,12 @@ version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615"
+[[package]]
+name = "windows_i686_gnu"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
+
[[package]]
name = "windows_i686_msvc"
version = "0.29.0"
@@ -12235,6 +12031,12 @@ version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172"
+[[package]]
+name = "windows_i686_msvc"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
+
[[package]]
name = "windows_x86_64_gnu"
version = "0.29.0"
@@ -12247,6 +12049,12 @@ version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc"
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
+
[[package]]
name = "windows_x86_64_msvc"
version = "0.29.0"
@@ -12259,6 +12067,12 @@ version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316"
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
+
[[package]]
name = "winreg"
version = "0.7.0"
@@ -12325,18 +12139,18 @@ dependencies = [
[[package]]
name = "zstd"
-version = "0.10.0+zstd.1.5.2"
+version = "0.11.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b1365becbe415f3f0fcd024e2f7b45bacfb5bdd055f0dc113571394114e7bdd"
+checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4"
dependencies = [
"zstd-safe",
]
[[package]]
name = "zstd-safe"
-version = "4.1.4+zstd.1.5.2"
+version = "5.0.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f7cd17c9af1a4d6c24beb1cc54b17e2ef7b593dc92f19e9d9acad8b182bbaee"
+checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db"
dependencies = [
"libc",
"zstd-sys",
@@ -12344,9 +12158,9 @@ dependencies = [
[[package]]
name = "zstd-sys"
-version = "1.6.3+zstd.1.5.2"
+version = "2.0.1+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8"
+checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b"
dependencies = [
"cc",
"libc",
diff --git a/Cargo.toml b/Cargo.toml
index 9909e6f893877..e2907716ca9f2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -116,6 +116,7 @@ members = [
"frame/nomination-pools",
"frame/nomination-pools/benchmarking",
"frame/nomination-pools/test-staking",
+ "frame/nomination-pools/runtime-api",
"frame/randomness-collective-flip",
"frame/ranked-collective",
"frame/recovery",
@@ -257,7 +258,7 @@ crc32fast = { opt-level = 3 }
crossbeam-deque = { opt-level = 3 }
crypto-mac = { opt-level = 3 }
curve25519-dalek = { opt-level = 3 }
-ed25519-dalek = { opt-level = 3 }
+ed25519-zebra = { opt-level = 3 }
flate2 = { opt-level = 3 }
futures-channel = { opt-level = 3 }
hashbrown = { opt-level = 3 }
diff --git a/README.md b/README.md
index b716794428a00..c609641af7ce2 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ Substrate is a next-generation framework for blockchain innovation 🚀.
## Trying it out
Simply go to [docs.substrate.io](https://docs.substrate.io) and follow the
-[installation](https://docs.substrate.io/v3/getting-started/overview) instructions. You can
+[installation](https://docs.substrate.io/main-docs/install/) instructions. You can
also try out one of the [tutorials](https://docs.substrate.io/tutorials/).
## Contributions & Code of Conduct
diff --git a/bin/node-template/README.md b/bin/node-template/README.md
index 8defb870fa1b0..0f6fd9450aeee 100644
--- a/bin/node-template/README.md
+++ b/bin/node-template/README.md
@@ -114,7 +114,7 @@ local node template.
### Multi-Node Local Testnet
If you want to see the multi-node consensus algorithm in action, refer to our
-[Start a Private Network tutorial](https://docs.substrate.io/tutorials/v3/private-network).
+[Simulate a network tutorial](https://docs.substrate.io/tutorials/get-started/simulate-network/).
## Template Structure
@@ -129,7 +129,7 @@ Substrate-based blockchain nodes expose a number of capabilities:
- Networking: Substrate nodes use the [`libp2p`](https://libp2p.io/) networking stack to allow the
nodes in the network to communicate with one another.
- Consensus: Blockchains must have a way to come to
- [consensus](https://docs.substrate.io/v3/advanced/consensus) on the state of the
+ [consensus](https://docs.substrate.io/main-docs/fundamentals/consensus/) on the state of the
network. Substrate makes it possible to supply custom consensus engines and also ships with
several consensus mechanisms that have been built on top of
[Web3 Foundation research](https://research.web3.foundation/en/latest/polkadot/NPoS/index.html).
@@ -138,22 +138,20 @@ Substrate-based blockchain nodes expose a number of capabilities:
There are several files in the `node` directory - take special note of the following:
- [`chain_spec.rs`](./node/src/chain_spec.rs): A
- [chain specification](https://docs.substrate.io/v3/runtime/chain-specs) is a
+ [chain specification](https://docs.substrate.io/main-docs/build/chain-spec/) is a
source code file that defines a Substrate chain's initial (genesis) state. Chain specifications
are useful for development and testing, and critical when architecting the launch of a
production chain. Take note of the `development_config` and `testnet_genesis` functions, which
are used to define the genesis state for the local development chain configuration. These
functions identify some
- [well-known accounts](https://docs.substrate.io/v3/tools/subkey#well-known-keys)
+ [well-known accounts](https://docs.substrate.io/reference/command-line-tools/subkey/)
and use them to configure the blockchain's initial state.
- [`service.rs`](./node/src/service.rs): This file defines the node implementation. Take note of
the libraries that this file imports and the names of the functions it invokes. In particular,
there are references to consensus-related topics, such as the
- [longest chain rule](https://docs.substrate.io/v3/advanced/consensus#longest-chain-rule),
- the [Aura](https://docs.substrate.io/v3/advanced/consensus#aura) block authoring
- mechanism and the
- [GRANDPA](https://docs.substrate.io/v3/advanced/consensus#grandpa) finality
- gadget.
+ [block finalization and forks](https://docs.substrate.io/main-docs/fundamentals/consensus/#finalization-and-forks)
+ and other [consensus mechanisms](https://docs.substrate.io/main-docs/fundamentals/consensus/#default-consensus-models)
+ such as Aura for block authoring and GRANDPA for finality.
After the node has been [built](#build), refer to the embedded documentation to learn more about the
capabilities and configuration parameters that it exposes:
@@ -165,16 +163,15 @@ capabilities and configuration parameters that it exposes:
### Runtime
In Substrate, the terms
-"[runtime](https://docs.substrate.io/v3/getting-started/glossary#runtime)" and
-"[state transition function](https://docs.substrate.io/v3/getting-started/glossary#state-transition-function-stf)"
+"runtime" and "state transition function"
are analogous - they refer to the core logic of the blockchain that is responsible for validating
blocks and executing the state changes they define. The Substrate project in this repository uses
-the [FRAME](https://docs.substrate.io/v3/runtime/frame) framework to construct a
+[FRAME](https://docs.substrate.io/main-docs/fundamentals/runtime-intro/#frame) to construct a
blockchain runtime. FRAME allows runtime developers to declare domain-specific logic in modules
called "pallets". At the heart of FRAME is a helpful
-[macro language](https://docs.substrate.io/v3/runtime/macros) that makes it easy to
+[macro language](https://docs.substrate.io/reference/frame-macros/) that makes it easy to
create pallets and flexibly compose them to create blockchains that can address
-[a variety of needs](https://www.substrate.io/substrate-users/).
+[a variety of needs](https://substrate.io/ecosystem/projects/).
Review the [FRAME runtime implementation](./runtime/src/lib.rs) included in this template and note
the following:
@@ -184,8 +181,7 @@ the following:
- The pallets are composed into a single runtime by way of the
[`construct_runtime!`](https://crates.parity.io/frame_support/macro.construct_runtime.html)
macro, which is part of the core
- [FRAME Support](https://docs.substrate.io/v3/runtime/frame#support-crate)
- library.
+ FRAME Support [system](https://docs.substrate.io/reference/frame-pallets/#system-pallets) library.
### Pallets
@@ -196,12 +192,12 @@ template pallet that is [defined in the `pallets`](./pallets/template/src/lib.rs
A FRAME pallet is compromised of a number of blockchain primitives:
- Storage: FRAME defines a rich set of powerful
- [storage abstractions](https://docs.substrate.io/v3/runtime/storage) that makes
+ [storage abstractions](https://docs.substrate.io/main-docs/build/runtime-storage/) that makes
it easy to use Substrate's efficient key-value database to manage the evolving state of a
blockchain.
- Dispatchables: FRAME pallets define special types of functions that can be invoked (dispatched)
from outside of the runtime in order to update its state.
-- Events: Substrate uses [events and errors](https://docs.substrate.io/v3/runtime/events-and-errors)
+- Events: Substrate uses [events and errors](https://docs.substrate.io/main-docs/build/events-errors/)
to notify users of important changes in the runtime.
- Errors: When a dispatchable fails, it returns an error.
- Config: The `Config` configuration interface is used to define the types and parameters upon
diff --git a/bin/node-template/docker-compose.yml b/bin/node-template/docker-compose.yml
index cfc4437bbae41..bc1922f47d963 100644
--- a/bin/node-template/docker-compose.yml
+++ b/bin/node-template/docker-compose.yml
@@ -3,7 +3,7 @@ version: "3.2"
services:
dev:
container_name: node-template
- image: paritytech/ci-linux:974ba3ac-20201006
+ image: paritytech/ci-linux:production
working_dir: /var/www/node-template
ports:
- "9944:9944"
diff --git a/bin/node-template/docs/rust-setup.md b/bin/node-template/docs/rust-setup.md
index ea133ca847af7..2755966e3ae0f 100644
--- a/bin/node-template/docs/rust-setup.md
+++ b/bin/node-template/docs/rust-setup.md
@@ -3,7 +3,7 @@ title: Installation
---
This guide is for reference only, please check the latest information on getting starting with Substrate
-[here](https://docs.substrate.io/v3/getting-started/installation/).
+[here](https://docs.substrate.io/main-docs/install/).
This page will guide you through the **2 steps** needed to prepare a computer for **Substrate** development.
Since Substrate is built with [the Rust programming language](https://www.rust-lang.org/), the first
@@ -73,11 +73,11 @@ brew install openssl
### Windows
-**_PLEASE NOTE:_** Native development of Substrate is _not_ very well supported! It is _highly_
+**_PLEASE NOTE:_** Native Windows development of Substrate is _not_ very well supported! It is _highly_
recommend to use [Windows Subsystem Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
(WSL) and follow the instructions for [Ubuntu/Debian](#ubuntudebian).
Please refer to the separate
-[guide for native Windows development](https://docs.substrate.io/v3/getting-started/windows-users/).
+[guide for native Windows development](https://docs.substrate.io/main-docs/install/windows/).
## Rust developer environment
diff --git a/bin/node-template/node/Cargo.toml b/bin/node-template/node/Cargo.toml
index c8e74ea9515ac..eeba198da8212 100644
--- a/bin/node-template/node/Cargo.toml
+++ b/bin/node-template/node/Cargo.toml
@@ -42,7 +42,7 @@ frame-system = { version = "4.0.0-dev", path = "../../../frame/system" }
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, path = "../../../frame/transaction-payment" }
# These dependencies are used for the node template's RPCs
-jsonrpsee = { version = "0.14.0", features = ["server"] }
+jsonrpsee = { version = "0.15.1", features = ["server"] }
sc-rpc = { version = "4.0.0-dev", path = "../../../client/rpc" }
sp-api = { version = "4.0.0-dev", path = "../../../primitives/api" }
sc-rpc-api = { version = "0.10.0-dev", path = "../../../client/rpc-api" }
diff --git a/bin/node-template/node/src/command_helper.rs b/bin/node-template/node/src/benchmarking.rs
similarity index 71%
rename from bin/node-template/node/src/command_helper.rs
rename to bin/node-template/node/src/benchmarking.rs
index 287e81b1e96bd..f0e32104cd3ee 100644
--- a/bin/node-template/node/src/command_helper.rs
+++ b/bin/node-template/node/src/benchmarking.rs
@@ -16,13 +16,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//! Contains code to setup the command invocations in [`super::command`] which would
-//! otherwise bloat that module.
+//! Setup code for [`super::command`] which would otherwise bloat that module.
+//!
+//! Should only be used for benchmarking as it may break in other contexts.
use crate::service::FullClient;
use node_template_runtime as runtime;
-use runtime::SystemCall;
+use runtime::{AccountId, Balance, BalancesCall, SystemCall};
use sc_cli::Result;
use sc_client_api::BlockBackend;
use sp_core::{Encode, Pair};
@@ -35,19 +36,27 @@ use std::{sync::Arc, time::Duration};
/// Generates extrinsics for the `benchmark overhead` command.
///
/// Note: Should only be used for benchmarking.
-pub struct BenchmarkExtrinsicBuilder {
+pub struct RemarkBuilder {
client: Arc,
}
-impl BenchmarkExtrinsicBuilder {
+impl RemarkBuilder {
/// Creates a new [`Self`] from the given client.
pub fn new(client: Arc) -> Self {
Self { client }
}
}
-impl frame_benchmarking_cli::ExtrinsicBuilder for BenchmarkExtrinsicBuilder {
- fn remark(&self, nonce: u32) -> std::result::Result {
+impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder {
+ fn pallet(&self) -> &str {
+ "system"
+ }
+
+ fn extrinsic(&self) -> &str {
+ "remark"
+ }
+
+ fn build(&self, nonce: u32) -> std::result::Result {
let acc = Sr25519Keyring::Bob.pair();
let extrinsic: OpaqueExtrinsic = create_benchmark_extrinsic(
self.client.as_ref(),
@@ -61,6 +70,49 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for BenchmarkExtrinsicBuilder {
}
}
+/// Generates `Balances::TransferKeepAlive` extrinsics for the benchmarks.
+///
+/// Note: Should only be used for benchmarking.
+pub struct TransferKeepAliveBuilder {
+ client: Arc,
+ dest: AccountId,
+ value: Balance,
+}
+
+impl TransferKeepAliveBuilder {
+ /// Creates a new [`Self`] from the given client.
+ pub fn new(client: Arc, dest: AccountId, value: Balance) -> Self {
+ Self { client, dest, value }
+ }
+}
+
+impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
+ fn pallet(&self) -> &str {
+ "balances"
+ }
+
+ fn extrinsic(&self) -> &str {
+ "transfer_keep_alive"
+ }
+
+ fn build(&self, nonce: u32) -> std::result::Result {
+ let acc = Sr25519Keyring::Bob.pair();
+ let extrinsic: OpaqueExtrinsic = create_benchmark_extrinsic(
+ self.client.as_ref(),
+ acc,
+ BalancesCall::transfer_keep_alive {
+ dest: self.dest.clone().into(),
+ value: self.value.into(),
+ }
+ .into(),
+ nonce,
+ )
+ .into();
+
+ Ok(extrinsic)
+ }
+}
+
/// Create a transaction using the given `call`.
///
/// Note: Should only be used for benchmarking.
diff --git a/bin/node-template/node/src/command.rs b/bin/node-template/node/src/command.rs
index e3e10007929e6..142f0b40c325e 100644
--- a/bin/node-template/node/src/command.rs
+++ b/bin/node-template/node/src/command.rs
@@ -1,14 +1,14 @@
use crate::{
+ benchmarking::{inherent_benchmark_data, RemarkBuilder, TransferKeepAliveBuilder},
chain_spec,
cli::{Cli, Subcommand},
- command_helper::{inherent_benchmark_data, BenchmarkExtrinsicBuilder},
service,
};
-use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
-use node_template_runtime::Block;
+use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE};
+use node_template_runtime::{Block, EXISTENTIAL_DEPOSIT};
use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
use sc_service::PartialComponents;
-use std::sync::Arc;
+use sp_keyring::Sr25519Keyring;
impl SubstrateCli for Cli {
fn impl_name() -> String {
@@ -137,9 +137,23 @@ pub fn run() -> sc_cli::Result<()> {
},
BenchmarkCmd::Overhead(cmd) => {
let PartialComponents { client, .. } = service::new_partial(&config)?;
- let ext_builder = BenchmarkExtrinsicBuilder::new(client.clone());
+ let ext_builder = RemarkBuilder::new(client.clone());
- cmd.run(config, client, inherent_benchmark_data()?, Arc::new(ext_builder))
+ cmd.run(config, client, inherent_benchmark_data()?, &ext_builder)
+ },
+ BenchmarkCmd::Extrinsic(cmd) => {
+ let PartialComponents { client, .. } = service::new_partial(&config)?;
+ // Register the *Remark* and *TKA* builders.
+ let ext_factory = ExtrinsicFactory(vec![
+ Box::new(RemarkBuilder::new(client.clone())),
+ Box::new(TransferKeepAliveBuilder::new(
+ client.clone(),
+ Sr25519Keyring::Alice.to_account_id(),
+ EXISTENTIAL_DEPOSIT,
+ )),
+ ]);
+
+ cmd.run(client, inherent_benchmark_data()?, &ext_factory)
},
BenchmarkCmd::Machine(cmd) =>
cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()),
diff --git a/bin/node-template/node/src/main.rs b/bin/node-template/node/src/main.rs
index 0f2fbd5a909c6..426cbabb6fbf7 100644
--- a/bin/node-template/node/src/main.rs
+++ b/bin/node-template/node/src/main.rs
@@ -4,9 +4,9 @@
mod chain_spec;
#[macro_use]
mod service;
+mod benchmarking;
mod cli;
mod command;
-mod command_helper;
mod rpc;
fn main() -> sc_cli::Result<()> {
diff --git a/bin/node-template/node/src/service.rs b/bin/node-template/node/src/service.rs
index f45f914d94f44..ffb2440caa0ed 100644
--- a/bin/node-template/node/src/service.rs
+++ b/bin/node-template/node/src/service.rs
@@ -296,24 +296,24 @@ pub fn new_full(mut config: Configuration) -> Result
.spawn_blocking("aura", Some("block-authoring"), aura);
}
- // if the node isn't actively participating in consensus then it doesn't
- // need a keystore, regardless of which protocol we use below.
- let keystore =
- if role.is_authority() { Some(keystore_container.sync_keystore()) } else { None };
-
- let grandpa_config = sc_finality_grandpa::Config {
- // FIXME #1578 make this available through chainspec
- gossip_duration: Duration::from_millis(333),
- justification_period: 512,
- name: Some(name),
- observer_enabled: false,
- keystore,
- local_role: role,
- telemetry: telemetry.as_ref().map(|x| x.handle()),
- protocol_name: grandpa_protocol_name,
- };
-
if enable_grandpa {
+ // if the node isn't actively participating in consensus then it doesn't
+ // need a keystore, regardless of which protocol we use below.
+ let keystore =
+ if role.is_authority() { Some(keystore_container.sync_keystore()) } else { None };
+
+ let grandpa_config = sc_finality_grandpa::Config {
+ // FIXME #1578 make this available through chainspec
+ gossip_duration: Duration::from_millis(333),
+ justification_period: 512,
+ name: Some(name),
+ observer_enabled: false,
+ keystore,
+ local_role: role,
+ telemetry: telemetry.as_ref().map(|x| x.handle()),
+ protocol_name: grandpa_protocol_name,
+ };
+
// start the full GRANDPA voter
// NOTE: non-authorities could run the GRANDPA observer protocol, but at
// this point the full voter should provide better guarantees of block
diff --git a/bin/node-template/pallets/template/src/lib.rs b/bin/node-template/pallets/template/src/lib.rs
index 067c7ce2575a0..f1519efe062bd 100644
--- a/bin/node-template/pallets/template/src/lib.rs
+++ b/bin/node-template/pallets/template/src/lib.rs
@@ -2,7 +2,7 @@
/// Edit this file to define custom logic or remove it if it is not needed.
/// Learn more about FRAME and the core library of Substrate FRAME pallets:
-///
+///
pub use pallet::*;
#[cfg(test)]
@@ -19,6 +19,10 @@ pub mod pallet {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
+ #[pallet::pallet]
+ #[pallet::generate_store(pub(super) trait Store)]
+ pub struct Pallet(_);
+
/// Configure the pallet by specifying the parameters and types on which it depends.
#[pallet::config]
pub trait Config: frame_system::Config {
@@ -26,20 +30,16 @@ pub mod pallet {
type Event: From> + IsType<::Event>;
}
- #[pallet::pallet]
- #[pallet::generate_store(pub(super) trait Store)]
- pub struct Pallet(_);
-
// The pallet's runtime storage items.
- // https://docs.substrate.io/v3/runtime/storage
+ // https://docs.substrate.io/main-docs/build/runtime-storage/
#[pallet::storage]
#[pallet::getter(fn something)]
// Learn more about declaring storage items:
- // https://docs.substrate.io/v3/runtime/storage#declaring-storage-items
+ // https://docs.substrate.io/main-docs/build/runtime-storage/#declaring-storage-items
pub type Something = StorageValue<_, u32>;
// Pallets use events to inform users when important changes are made.
- // https://docs.substrate.io/v3/runtime/events-and-errors
+ // https://docs.substrate.io/main-docs/build/events-errors/
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event {
@@ -68,7 +68,7 @@ pub mod pallet {
pub fn do_something(origin: OriginFor, something: u32) -> DispatchResult {
// Check that the extrinsic was signed and get the signer.
// This function will return an error if the extrinsic is not signed.
- // https://docs.substrate.io/v3/runtime/origins
+ // https://docs.substrate.io/main-docs/build/origins/
let who = ensure_signed(origin)?;
// Update storage.
diff --git a/bin/node-template/pallets/template/src/mock.rs b/bin/node-template/pallets/template/src/mock.rs
index 8721fe6c78851..e03f37b2eea69 100644
--- a/bin/node-template/pallets/template/src/mock.rs
+++ b/bin/node-template/pallets/template/src/mock.rs
@@ -17,8 +17,8 @@ frame_support::construct_runtime!(
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
- System: frame_system::{Pallet, Call, Config, Storage, Event},
- TemplateModule: pallet_template::{Pallet, Call, Storage, Event},
+ System: frame_system,
+ TemplateModule: pallet_template,
}
);
diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs
index c514cdf6c25fd..b43fbde52dcdc 100644
--- a/bin/node-template/runtime/src/lib.rs
+++ b/bin/node-template/runtime/src/lib.rs
@@ -89,8 +89,8 @@ pub mod opaque {
}
}
-// To learn more about runtime versioning and what each of the following value means:
-// https://docs.substrate.io/v3/runtime/upgrades#runtime-versioning
+// To learn more about runtime versioning, see:
+// https://docs.substrate.io/main-docs/build/upgrade#runtime-versioning
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("node-template"),
@@ -234,6 +234,9 @@ impl pallet_timestamp::Config for Runtime {
type WeightInfo = ();
}
+/// Existential deposit.
+pub const EXISTENTIAL_DEPOSIT: u128 = 500;
+
impl pallet_balances::Config for Runtime {
type MaxLocks = ConstU32<50>;
type MaxReserves = ();
@@ -243,7 +246,7 @@ impl pallet_balances::Config for Runtime {
/// The ubiquitous event type.
type Event = Event;
type DustRemoval = ();
- type ExistentialDeposit = ConstU128<500>;
+ type ExistentialDeposit = ConstU128;
type AccountStore = System;
type WeightInfo = pallet_balances::weights::SubstrateWeight;
}
@@ -269,10 +272,11 @@ impl pallet_template::Config for Runtime {
// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
- pub enum Runtime where
+ pub struct Runtime
+ where
Block = Block,
NodeBlock = opaque::Block,
- UncheckedExtrinsic = UncheckedExtrinsic
+ UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system,
RandomnessCollectiveFlip: pallet_randomness_collective_flip,
@@ -463,6 +467,23 @@ impl_runtime_apis! {
}
}
+ impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi
+ for Runtime
+ {
+ fn query_call_info(
+ call: Call,
+ len: u32,
+ ) -> pallet_transaction_payment::RuntimeDispatchInfo {
+ TransactionPayment::query_call_info(call, len)
+ }
+ fn query_call_fee_details(
+ call: Call,
+ len: u32,
+ ) -> pallet_transaction_payment::FeeDetails {
+ TransactionPayment::query_call_fee_details(call, len)
+ }
+ }
+
#[cfg(feature = "runtime-benchmarks")]
impl frame_benchmarking::Benchmark for Runtime {
fn benchmark_metadata(extra: bool) -> (
diff --git a/bin/node/bench/Cargo.toml b/bin/node/bench/Cargo.toml
index 90c325b8e5b32..4d090c71a72e9 100644
--- a/bin/node/bench/Cargo.toml
+++ b/bin/node/bench/Cargo.toml
@@ -13,7 +13,7 @@ clap = { version = "3.1.18", features = ["derive"] }
log = "0.4.17"
node-primitives = { version = "2.0.0", path = "../primitives" }
node-testing = { version = "3.0.0-dev", path = "../testing" }
-node-runtime = { version = "3.0.0-dev", path = "../runtime" }
+kitchensink-runtime = { version = "3.0.0-dev", path = "../runtime" }
sc-client-api = { version = "4.0.0-dev", path = "../../../client/api/" }
sp-runtime = { version = "6.0.0", path = "../../../primitives/runtime" }
sp-state-machine = { version = "0.12.0", path = "../../../primitives/state-machine" }
diff --git a/bin/node/bench/src/import.rs b/bin/node/bench/src/import.rs
index b9229fbd5331d..47f630eb68700 100644
--- a/bin/node/bench/src/import.rs
+++ b/bin/node/bench/src/import.rs
@@ -148,13 +148,13 @@ impl core::Benchmark for ImportBenchmark {
// the transaction fee into the treasury
// - extrinsic success
assert_eq!(
- node_runtime::System::events().len(),
+ kitchensink_runtime::System::events().len(),
(self.block.extrinsics.len() - 1) * 8 + 1,
);
},
BlockType::Noop => {
assert_eq!(
- node_runtime::System::events().len(),
+ kitchensink_runtime::System::events().len(),
// should be 2 per signed extrinsic + 1 per unsigned
// we have 1 unsigned and the rest are signed in the block
// those 2 events per signed are:
diff --git a/bin/node/bench/src/simple_trie.rs b/bin/node/bench/src/simple_trie.rs
index c59389570e534..aa9c96a1cbd3f 100644
--- a/bin/node/bench/src/simple_trie.rs
+++ b/bin/node/bench/src/simple_trie.rs
@@ -33,7 +33,7 @@ pub struct SimpleTrie<'a> {
impl<'a> AsHashDB for SimpleTrie<'a> {
fn as_hash_db(&self) -> &dyn hash_db::HashDB {
- &*self
+ self
}
fn as_hash_db_mut<'b>(&'b mut self) -> &'b mut (dyn HashDB + 'b) {
diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml
index b2e24f0b33189..89ca3ebb45576 100644
--- a/bin/node/cli/Cargo.toml
+++ b/bin/node/cli/Cargo.toml
@@ -37,7 +37,7 @@ crate-type = ["cdylib", "rlib"]
clap = { version = "3.1.18", features = ["derive"], optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0" }
serde = { version = "1.0.136", features = ["derive"] }
-jsonrpsee = { version = "0.14.0", features = ["server"] }
+jsonrpsee = { version = "0.15.1", features = ["server"] }
futures = "0.3.21"
hex-literal = "0.3.4"
log = "0.4.17"
@@ -66,6 +66,7 @@ sc-consensus = { version = "0.10.0-dev", path = "../../../client/consensus/commo
sc-transaction-pool = { version = "4.0.0-dev", path = "../../../client/transaction-pool" }
sc-transaction-pool-api = { version = "4.0.0-dev", path = "../../../client/transaction-pool/api" }
sc-network = { version = "0.10.0-dev", path = "../../../client/network" }
+sc-network-common = { version = "0.10.0-dev", path = "../../../client/network/common" }
sc-consensus-slots = { version = "0.10.0-dev", path = "../../../client/consensus/slots" }
sc-consensus-babe = { version = "0.10.0-dev", path = "../../../client/consensus/babe" }
sc-consensus-uncles = { version = "0.10.0-dev", path = "../../../client/consensus/uncles" }
@@ -87,7 +88,7 @@ pallet-asset-tx-payment = { version = "4.0.0-dev", path = "../../../frame/transa
pallet-im-online = { version = "4.0.0-dev", default-features = false, path = "../../../frame/im-online" }
# node-specific dependencies
-node-runtime = { version = "3.0.0-dev", path = "../runtime" }
+kitchensink-runtime = { version = "3.0.0-dev", path = "../runtime" }
node-rpc = { version = "3.0.0-dev", path = "../rpc" }
node-primitives = { version = "2.0.0", path = "../primitives" }
node-executor = { version = "3.0.0-dev", path = "../executor" }
@@ -159,10 +160,10 @@ cli = [
"substrate-build-script-utils",
"try-runtime-cli",
]
-runtime-benchmarks = ["node-runtime/runtime-benchmarks", "frame-benchmarking-cli"]
+runtime-benchmarks = ["kitchensink-runtime/runtime-benchmarks", "frame-benchmarking-cli"]
# Enable features that allow the runtime to be tried and debugged. Name might be subject to change
# in the near future.
-try-runtime = ["node-runtime/try-runtime", "try-runtime-cli"]
+try-runtime = ["kitchensink-runtime/try-runtime", "try-runtime-cli"]
[[bench]]
name = "transaction_pool"
diff --git a/bin/node/cli/benches/block_production.rs b/bin/node/cli/benches/block_production.rs
index ad16ba8e4072b..8420a65f8cb80 100644
--- a/bin/node/cli/benches/block_production.rs
+++ b/bin/node/cli/benches/block_production.rs
@@ -18,8 +18,8 @@
use criterion::{criterion_group, criterion_main, BatchSize, Criterion, Throughput};
+use kitchensink_runtime::{constants::currency::*, BalancesCall};
use node_cli::service::{create_extrinsic, FullClient};
-use node_runtime::{constants::currency::*, BalancesCall};
use sc_block_builder::{BlockBuilderProvider, BuiltBlock, RecordProof};
use sc_client_api::execution_extensions::ExecutionStrategies;
use sc_consensus::{
@@ -28,7 +28,7 @@ use sc_consensus::{
};
use sc_service::{
config::{
- DatabaseSource, KeepBlocks, KeystoreConfig, NetworkConfiguration, OffchainWorkerConfig,
+ BlocksPruning, DatabaseSource, KeystoreConfig, NetworkConfiguration, OffchainWorkerConfig,
PruningMode, WasmExecutionMethod, WasmtimeInstantiationStrategy,
},
BasePath, Configuration, Role,
@@ -75,7 +75,7 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
state_cache_size: 67108864,
state_cache_child_ratio: None,
state_pruning: Some(PruningMode::ArchiveAll),
- keep_blocks: KeepBlocks::All,
+ blocks_pruning: BlocksPruning::All,
chain_spec: spec,
wasm_method: WasmExecutionMethod::Compiled {
instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite,
@@ -121,9 +121,9 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
}
fn extrinsic_set_time(now: u64) -> OpaqueExtrinsic {
- node_runtime::UncheckedExtrinsic {
+ kitchensink_runtime::UncheckedExtrinsic {
signature: None,
- function: node_runtime::Call::Timestamp(pallet_timestamp::Call::set { now }),
+ function: kitchensink_runtime::Call::Timestamp(pallet_timestamp::Call::set { now }),
}
.into()
}
diff --git a/bin/node/cli/benches/transaction_pool.rs b/bin/node/cli/benches/transaction_pool.rs
index f1fce16d8c1b3..f031f9dae3d21 100644
--- a/bin/node/cli/benches/transaction_pool.rs
+++ b/bin/node/cli/benches/transaction_pool.rs
@@ -16,15 +16,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+use std::time::Duration;
+
use criterion::{criterion_group, criterion_main, BatchSize, Criterion, Throughput};
use futures::{future, StreamExt};
+use kitchensink_runtime::{constants::currency::*, BalancesCall, SudoCall};
use node_cli::service::{create_extrinsic, fetch_nonce, FullClient, TransactionPool};
use node_primitives::AccountId;
-use node_runtime::{constants::currency::*, BalancesCall, SudoCall};
use sc_client_api::execution_extensions::ExecutionStrategies;
use sc_service::{
config::{
- DatabaseSource, KeepBlocks, KeystoreConfig, NetworkConfiguration, OffchainWorkerConfig,
+ BlocksPruning, DatabaseSource, KeystoreConfig, NetworkConfiguration, OffchainWorkerConfig,
PruningMode, TransactionPoolOptions, WasmExecutionMethod,
},
BasePath, Configuration, Role,
@@ -58,6 +60,7 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
ready: PoolLimit { count: 100_000, total_bytes: 100 * 1024 * 1024 },
future: PoolLimit { count: 100_000, total_bytes: 100 * 1024 * 1024 },
reject_future_transactions: false,
+ ban_time: Duration::from_secs(30 * 60),
},
network: network_config,
keystore: KeystoreConfig::InMemory,
@@ -66,7 +69,7 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
state_cache_size: 67108864,
state_cache_child_ratio: None,
state_pruning: Some(PruningMode::ArchiveAll),
- keep_blocks: KeepBlocks::All,
+ blocks_pruning: BlocksPruning::All,
chain_spec: spec,
wasm_method: WasmExecutionMethod::Interpreted,
// NOTE: we enforce the use of the native runtime to make the errors more debuggable
@@ -240,25 +243,25 @@ fn transaction_pool_benchmarks(c: &mut Criterion) {
move |b| {
b.iter_batched(
|| {
- let prepare_extrinsics = create_account_extrinsics(&*node.client, &accounts);
+ let prepare_extrinsics = create_account_extrinsics(&node.client, &accounts);
runtime.block_on(future::join_all(prepare_extrinsics.into_iter().map(|tx| {
submit_tx_and_wait_for_inclusion(
&node.transaction_pool,
tx,
- &*node.client,
+ &node.client,
true,
)
})));
- create_benchmark_extrinsics(&*node.client, &accounts, extrinsics_per_account)
+ create_benchmark_extrinsics(&node.client, &accounts, extrinsics_per_account)
},
|extrinsics| {
runtime.block_on(future::join_all(extrinsics.into_iter().map(|tx| {
submit_tx_and_wait_for_inclusion(
&node.transaction_pool,
tx,
- &*node.client,
+ &node.client,
false,
)
})));
diff --git a/bin/node/cli/src/command_helper.rs b/bin/node/cli/src/benchmarking.rs
similarity index 52%
rename from bin/node/cli/src/command_helper.rs
rename to bin/node/cli/src/benchmarking.rs
index 84d85ee367cab..19bd1660a4dd9 100644
--- a/bin/node/cli/src/command_helper.rs
+++ b/bin/node/cli/src/benchmarking.rs
@@ -16,12 +16,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//! Contains code to setup the command invocations in [`super::command`] which would
-//! otherwise bloat that module.
+//! Setup code for [`super::command`] which would otherwise bloat that module.
+//!
+//! Should only be used for benchmarking as it may break in other contexts.
use crate::service::{create_extrinsic, FullClient};
-use node_runtime::SystemCall;
+use kitchensink_runtime::{BalancesCall, SystemCall};
+use node_primitives::{AccountId, Balance};
use sc_cli::Result;
use sp_inherents::{InherentData, InherentDataProvider};
use sp_keyring::Sr25519Keyring;
@@ -29,20 +31,30 @@ use sp_runtime::OpaqueExtrinsic;
use std::{sync::Arc, time::Duration};
-/// Generates extrinsics for the `benchmark overhead` command.
-pub struct BenchmarkExtrinsicBuilder {
+/// Generates `System::Remark` extrinsics for the benchmarks.
+///
+/// Note: Should only be used for benchmarking.
+pub struct RemarkBuilder {
client: Arc,
}
-impl BenchmarkExtrinsicBuilder {
+impl RemarkBuilder {
/// Creates a new [`Self`] from the given client.
pub fn new(client: Arc) -> Self {
Self { client }
}
}
-impl frame_benchmarking_cli::ExtrinsicBuilder for BenchmarkExtrinsicBuilder {
- fn remark(&self, nonce: u32) -> std::result::Result {
+impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder {
+ fn pallet(&self) -> &str {
+ "system"
+ }
+
+ fn extrinsic(&self) -> &str {
+ "remark"
+ }
+
+ fn build(&self, nonce: u32) -> std::result::Result {
let acc = Sr25519Keyring::Bob.pair();
let extrinsic: OpaqueExtrinsic = create_extrinsic(
self.client.as_ref(),
@@ -56,6 +68,48 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for BenchmarkExtrinsicBuilder {
}
}
+/// Generates `Balances::TransferKeepAlive` extrinsics for the benchmarks.
+///
+/// Note: Should only be used for benchmarking.
+pub struct TransferKeepAliveBuilder {
+ client: Arc,
+ dest: AccountId,
+ value: Balance,
+}
+
+impl TransferKeepAliveBuilder {
+ /// Creates a new [`Self`] from the given client.
+ pub fn new(client: Arc, dest: AccountId, value: Balance) -> Self {
+ Self { client, dest, value }
+ }
+}
+
+impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
+ fn pallet(&self) -> &str {
+ "balances"
+ }
+
+ fn extrinsic(&self) -> &str {
+ "transfer_keep_alive"
+ }
+
+ fn build(&self, nonce: u32) -> std::result::Result {
+ let acc = Sr25519Keyring::Bob.pair();
+ let extrinsic: OpaqueExtrinsic = create_extrinsic(
+ self.client.as_ref(),
+ acc,
+ BalancesCall::transfer_keep_alive {
+ dest: self.dest.clone().into(),
+ value: self.value.into(),
+ },
+ Some(nonce),
+ )
+ .into();
+
+ Ok(extrinsic)
+ }
+}
+
/// Generates inherent data for the `benchmark overhead` command.
pub fn inherent_benchmark_data() -> Result {
let mut inherent_data = InherentData::new();
diff --git a/bin/node/cli/src/chain_spec.rs b/bin/node/cli/src/chain_spec.rs
index 47c3634aa00df..77e2f73dd6e18 100644
--- a/bin/node/cli/src/chain_spec.rs
+++ b/bin/node/cli/src/chain_spec.rs
@@ -20,7 +20,7 @@
use grandpa_primitives::AuthorityId as GrandpaId;
use hex_literal::hex;
-use node_runtime::{
+use kitchensink_runtime::{
constants::currency::*, wasm_binary_unwrap, AuthorityDiscoveryConfig, BabeConfig,
BalancesConfig, Block, CouncilConfig, DemocracyConfig, ElectionsConfig, GrandpaConfig,
ImOnlineConfig, IndicesConfig, MaxNominations, NominationPoolsConfig, SessionConfig,
@@ -40,8 +40,8 @@ use sp_runtime::{
Perbill,
};
+pub use kitchensink_runtime::GenesisConfig;
pub use node_primitives::{AccountId, Balance, Signature};
-pub use node_runtime::GenesisConfig;
type AccountPublic = ::Signer;
@@ -343,7 +343,7 @@ pub fn testnet_genesis(
sudo: SudoConfig { key: Some(root_key) },
babe: BabeConfig {
authorities: vec![],
- epoch_config: Some(node_runtime::BABE_GENESIS_EPOCH_CONFIG),
+ epoch_config: Some(kitchensink_runtime::BABE_GENESIS_EPOCH_CONFIG),
},
im_online: ImOnlineConfig { keys: vec![] },
authority_discovery: AuthorityDiscoveryConfig { keys: vec![] },
diff --git a/bin/node/cli/src/command.rs b/bin/node/cli/src/command.rs
index b17a26fa02935..85e5415dbe139 100644
--- a/bin/node/cli/src/command.rs
+++ b/bin/node/cli/src/command.rs
@@ -16,18 +16,19 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use super::command_helper::{inherent_benchmark_data, BenchmarkExtrinsicBuilder};
+use super::benchmarking::{inherent_benchmark_data, RemarkBuilder, TransferKeepAliveBuilder};
use crate::{
chain_spec, service,
service::{new_partial, FullClient},
Cli, Subcommand,
};
use frame_benchmarking_cli::*;
+use kitchensink_runtime::{ExistentialDeposit, RuntimeApi};
use node_executor::ExecutorDispatch;
use node_primitives::Block;
-use node_runtime::RuntimeApi;
use sc_cli::{ChainSpec, Result, RuntimeVersion, SubstrateCli};
use sc_service::PartialComponents;
+use sp_keyring::Sr25519Keyring;
use std::sync::Arc;
@@ -74,7 +75,7 @@ impl SubstrateCli for Cli {
}
fn native_runtime_version(_: &Box) -> &'static RuntimeVersion {
- &node_runtime::VERSION
+ &kitchensink_runtime::VERSION
}
}
@@ -126,9 +127,23 @@ pub fn run() -> Result<()> {
},
BenchmarkCmd::Overhead(cmd) => {
let PartialComponents { client, .. } = new_partial(&config)?;
- let ext_builder = BenchmarkExtrinsicBuilder::new(client.clone());
+ let ext_builder = RemarkBuilder::new(client.clone());
- cmd.run(config, client, inherent_benchmark_data()?, Arc::new(ext_builder))
+ cmd.run(config, client, inherent_benchmark_data()?, &ext_builder)
+ },
+ BenchmarkCmd::Extrinsic(cmd) => {
+ let PartialComponents { client, .. } = service::new_partial(&config)?;
+ // Register the *Remark* and *TKA* builders.
+ let ext_factory = ExtrinsicFactory(vec![
+ Box::new(RemarkBuilder::new(client.clone())),
+ Box::new(TransferKeepAliveBuilder::new(
+ client.clone(),
+ Sr25519Keyring::Alice.to_account_id(),
+ ExistentialDeposit::get(),
+ )),
+ ]);
+
+ cmd.run(client, inherent_benchmark_data()?, &ext_factory)
},
BenchmarkCmd::Machine(cmd) =>
cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()),
diff --git a/bin/node/cli/src/lib.rs b/bin/node/cli/src/lib.rs
index 06c0bcccbc296..13c074268e50f 100644
--- a/bin/node/cli/src/lib.rs
+++ b/bin/node/cli/src/lib.rs
@@ -35,11 +35,11 @@ pub mod chain_spec;
#[macro_use]
pub mod service;
#[cfg(feature = "cli")]
+mod benchmarking;
+#[cfg(feature = "cli")]
mod cli;
#[cfg(feature = "cli")]
mod command;
-#[cfg(feature = "cli")]
-mod command_helper;
#[cfg(feature = "cli")]
pub use cli::*;
diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs
index bff4be88002fb..b20a3ac59a96a 100644
--- a/bin/node/cli/src/service.rs
+++ b/bin/node/cli/src/service.rs
@@ -23,13 +23,14 @@
use codec::Encode;
use frame_system_rpc_runtime_api::AccountNonceApi;
use futures::prelude::*;
+use kitchensink_runtime::RuntimeApi;
use node_executor::ExecutorDispatch;
use node_primitives::Block;
-use node_runtime::RuntimeApi;
use sc_client_api::{BlockBackend, ExecutorProvider};
use sc_consensus_babe::{self, SlotProportion};
use sc_executor::NativeElseWasmExecutor;
-use sc_network::{Event, NetworkService};
+use sc_network::NetworkService;
+use sc_network_common::{protocol::event::Event, service::NetworkEventStream};
use sc_service::{config::Configuration, error::Error as ServiceError, RpcHandlers, TaskManager};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sp_api::ProvideRuntimeApi;
@@ -68,41 +69,43 @@ pub fn fetch_nonce(client: &FullClient, account: sp_core::sr25519::Pair) -> u32
pub fn create_extrinsic(
client: &FullClient,
sender: sp_core::sr25519::Pair,
- function: impl Into,
+ function: impl Into,
nonce: Option,
-) -> node_runtime::UncheckedExtrinsic {
+) -> kitchensink_runtime::UncheckedExtrinsic {
let function = function.into();
let genesis_hash = client.block_hash(0).ok().flatten().expect("Genesis block exists; qed");
let best_hash = client.chain_info().best_hash;
let best_block = client.chain_info().best_number;
let nonce = nonce.unwrap_or_else(|| fetch_nonce(client, sender.clone()));
- let period = node_runtime::BlockHashCount::get()
+ let period = kitchensink_runtime::BlockHashCount::get()
.checked_next_power_of_two()
.map(|c| c / 2)
.unwrap_or(2) as u64;
let tip = 0;
- let extra: node_runtime::SignedExtra = (
- frame_system::CheckNonZeroSender::::new(),
- frame_system::CheckSpecVersion::::new(),
- frame_system::CheckTxVersion::::new(),
- frame_system::CheckGenesis::::new(),
- frame_system::CheckEra::::from(generic::Era::mortal(
+ let extra: kitchensink_runtime::SignedExtra = (
+ frame_system::CheckNonZeroSender::::new(),
+ frame_system::CheckSpecVersion::::new(),
+ frame_system::CheckTxVersion::::new(),
+ frame_system::CheckGenesis::::new(),
+ frame_system::CheckEra::::from(generic::Era::mortal(
period,
best_block.saturated_into(),
)),
- frame_system::CheckNonce::::from(nonce),
- frame_system::CheckWeight::::new(),
- pallet_asset_tx_payment::ChargeAssetTxPayment::::from(tip, None),
+ frame_system::CheckNonce::::from(nonce),
+ frame_system::CheckWeight::::new(),
+ pallet_asset_tx_payment::ChargeAssetTxPayment::::from(
+ tip, None,
+ ),
);
- let raw_payload = node_runtime::SignedPayload::from_raw(
+ let raw_payload = kitchensink_runtime::SignedPayload::from_raw(
function.clone(),
extra.clone(),
(
(),
- node_runtime::VERSION.spec_version,
- node_runtime::VERSION.transaction_version,
+ kitchensink_runtime::VERSION.spec_version,
+ kitchensink_runtime::VERSION.transaction_version,
genesis_hash,
best_hash,
(),
@@ -112,10 +115,10 @@ pub fn create_extrinsic(
);
let signature = raw_payload.using_encoded(|e| sender.sign(e));
- node_runtime::UncheckedExtrinsic::new_signed(
+ kitchensink_runtime::UncheckedExtrinsic::new_signed(
function,
sp_runtime::AccountId32::from(sender.public()).into(),
- node_runtime::Signature::Sr25519(signature),
+ kitchensink_runtime::Signature::Sr25519(signature),
extra,
)
}
@@ -565,11 +568,11 @@ pub fn new_full(
mod tests {
use crate::service::{new_full_base, NewFullBase};
use codec::Encode;
- use node_primitives::{Block, DigestItem, Signature};
- use node_runtime::{
+ use kitchensink_runtime::{
constants::{currency::CENTS, time::SLOT_DURATION},
Address, BalancesCall, Call, UncheckedExtrinsic,
};
+ use node_primitives::{Block, DigestItem, Signature};
use sc_client_api::BlockBackend;
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy};
use sc_consensus_babe::{BabeIntermediate, CompatibleDigestItem, INTERMEDIATE_KEY};
diff --git a/bin/node/cli/tests/benchmark_extrinsic_works.rs b/bin/node/cli/tests/benchmark_extrinsic_works.rs
new file mode 100644
index 0000000000000..69800ad3c6c13
--- /dev/null
+++ b/bin/node/cli/tests/benchmark_extrinsic_works.rs
@@ -0,0 +1,46 @@
+// This file is part of Substrate.
+
+// Copyright (C) 2022 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.
+
+// 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
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+use assert_cmd::cargo::cargo_bin;
+use std::process::Command;
+use tempfile::tempdir;
+
+/// Tests that the `benchmark extrinsic` command works for
+/// remark and transfer_keep_alive within the substrate dev runtime.
+#[test]
+fn benchmark_extrinsic_works() {
+ benchmark_extrinsic("system", "remark");
+ benchmark_extrinsic("balances", "transfer_keep_alive");
+}
+
+/// Checks that the `benchmark extrinsic` command works for the given pallet and extrinsic.
+fn benchmark_extrinsic(pallet: &str, extrinsic: &str) {
+ let base_dir = tempdir().expect("could not create a temp dir");
+
+ let status = Command::new(cargo_bin("substrate"))
+ .args(&["benchmark", "extrinsic", "--dev"])
+ .arg("-d")
+ .arg(base_dir.path())
+ .args(&["--pallet", pallet, "--extrinsic", extrinsic])
+ // Run with low repeats for faster execution.
+ .args(["--warmup=10", "--repeat=10", "--max-ext-per-block=10"])
+ .status()
+ .unwrap();
+
+ assert!(status.success());
+}
diff --git a/bin/node/cli/tests/benchmark_pallet_works.rs b/bin/node/cli/tests/benchmark_pallet_works.rs
new file mode 100644
index 0000000000000..bf29c0e308bcb
--- /dev/null
+++ b/bin/node/cli/tests/benchmark_pallet_works.rs
@@ -0,0 +1,49 @@
+// This file is part of Substrate.
+
+// Copyright (C) 2022 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.
+
+// 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
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+use assert_cmd::cargo::cargo_bin;
+use std::process::Command;
+
+pub mod common;
+
+/// `benchmark pallet` works for the different combinations of `steps` and `repeat`.
+#[test]
+fn benchmark_pallet_works() {
+ // Some invalid combinations:
+ benchmark_pallet(0, 10, false);
+ benchmark_pallet(1, 10, false);
+ // ... and some valid:
+ benchmark_pallet(2, 1, true);
+ benchmark_pallet(50, 20, true);
+ benchmark_pallet(20, 50, true);
+}
+
+fn benchmark_pallet(steps: u32, repeat: u32, should_work: bool) {
+ let output = Command::new(cargo_bin("substrate"))
+ .args(["benchmark", "pallet", "--dev"])
+ // Use the `addition` benchmark since is the fastest.
+ .args(["--pallet", "frame-benchmarking", "--extrinsic", "addition"])
+ .args(["--steps", &format!("{}", steps), "--repeat", &format!("{}", repeat)])
+ .output()
+ .unwrap();
+
+ if output.status.success() != should_work {
+ let log = String::from_utf8_lossy(&output.stderr).to_string();
+ panic!("Test failed:\n{}", log);
+ }
+}
diff --git a/bin/node/executor/Cargo.toml b/bin/node/executor/Cargo.toml
index 5fbf59a74fdcd..71865783da8ac 100644
--- a/bin/node/executor/Cargo.toml
+++ b/bin/node/executor/Cargo.toml
@@ -16,7 +16,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0" }
scale-info = { version = "2.1.1", features = ["derive"] }
frame-benchmarking = { version = "4.0.0-dev", path = "../../../frame/benchmarking" }
node-primitives = { version = "2.0.0", path = "../primitives" }
-node-runtime = { version = "3.0.0-dev", path = "../runtime" }
+kitchensink-runtime = { version = "3.0.0-dev", path = "../runtime" }
sc-executor = { version = "0.10.0-dev", path = "../../../client/executor" }
sp-core = { version = "6.0.0", path = "../../../primitives/core" }
sp-keystore = { version = "0.12.0", path = "../../../primitives/keystore" }
@@ -34,6 +34,7 @@ node-testing = { version = "3.0.0-dev", path = "../testing" }
pallet-balances = { version = "4.0.0-dev", path = "../../../frame/balances" }
pallet-contracts = { version = "4.0.0-dev", path = "../../../frame/contracts" }
pallet-im-online = { version = "4.0.0-dev", path = "../../../frame/im-online" }
+pallet-sudo = { version = "4.0.0-dev", path = "../../../frame/sudo" }
pallet-timestamp = { version = "4.0.0-dev", path = "../../../frame/timestamp" }
pallet-treasury = { version = "4.0.0-dev", path = "../../../frame/treasury" }
pallet-transaction-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment" }
diff --git a/bin/node/executor/benches/bench.rs b/bin/node/executor/benches/bench.rs
index 61e2d1b053012..a1d31a5a966db 100644
--- a/bin/node/executor/benches/bench.rs
+++ b/bin/node/executor/benches/bench.rs
@@ -18,12 +18,12 @@
use codec::{Decode, Encode};
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
use frame_support::Hashable;
-use node_executor::ExecutorDispatch;
-use node_primitives::{BlockNumber, Hash};
-use node_runtime::{
+use kitchensink_runtime::{
constants::currency::*, Block, BuildStorage, Call, CheckedExtrinsic, GenesisConfig, Header,
UncheckedExtrinsic,
};
+use node_executor::ExecutorDispatch;
+use node_primitives::{BlockNumber, Hash};
use node_testing::keyring::*;
#[cfg(feature = "wasmtime")]
use sc_executor::WasmtimeInstantiationStrategy;
@@ -41,7 +41,7 @@ criterion_main!(benches);
/// The wasm runtime code.
pub fn compact_code_unwrap() -> &'static [u8] {
- node_runtime::WASM_BINARY.expect(
+ kitchensink_runtime::WASM_BINARY.expect(
"Development wasm binary is not available. Testing is only supported with the flag \
disabled.",
)
@@ -49,9 +49,9 @@ pub fn compact_code_unwrap() -> &'static [u8] {
const GENESIS_HASH: [u8; 32] = [69u8; 32];
-const TRANSACTION_VERSION: u32 = node_runtime::VERSION.transaction_version;
+const TRANSACTION_VERSION: u32 = kitchensink_runtime::VERSION.transaction_version;
-const SPEC_VERSION: u32 = node_runtime::VERSION.spec_version;
+const SPEC_VERSION: u32 = kitchensink_runtime::VERSION.spec_version;
const HEAP_PAGES: u64 = 20;
diff --git a/bin/node/executor/src/lib.rs b/bin/node/executor/src/lib.rs
index 9f87c7d12623c..c4edf5ad22f47 100644
--- a/bin/node/executor/src/lib.rs
+++ b/bin/node/executor/src/lib.rs
@@ -28,10 +28,10 @@ impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
fn dispatch(method: &str, data: &[u8]) -> Option> {
- node_runtime::api::dispatch(method, data)
+ kitchensink_runtime::api::dispatch(method, data)
}
fn native_version() -> sc_executor::NativeVersion {
- node_runtime::native_version()
+ kitchensink_runtime::native_version()
}
}
diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs
index de2aa6c18369d..27e848a281097 100644
--- a/bin/node/executor/tests/basic.rs
+++ b/bin/node/executor/tests/basic.rs
@@ -26,12 +26,12 @@ use sp_runtime::{
traits::Hash as HashT, transaction_validity::InvalidTransaction, ApplyExtrinsicResult,
};
-use node_primitives::{Balance, Hash};
-use node_runtime::{
+use kitchensink_runtime::{
constants::{currency::*, time::SLOT_DURATION},
Balances, Call, CheckedExtrinsic, Event, Header, Runtime, System, TransactionPayment,
UncheckedExtrinsic,
};
+use node_primitives::{Balance, Hash};
use node_testing::keyring::*;
use wat;
@@ -44,7 +44,7 @@ use self::common::{sign, *};
/// have to execute provided wasm code instead of the native equivalent. This trick is used to
/// test code paths that differ between native and wasm versions.
pub fn bloaty_code_unwrap() -> &'static [u8] {
- node_runtime::WASM_BINARY_BLOATY.expect(
+ kitchensink_runtime::WASM_BINARY_BLOATY.expect(
"Development wasm binary is not available. \
Testing is only supported with the flag disabled.",
)
@@ -764,7 +764,11 @@ fn deploying_wasm_contract_should_work() {
t.execute_with(|| {
// Verify that the contract does exist by querying some of its storage items
// It does not matter that the storage item itself does not exist.
- assert!(&pallet_contracts::Pallet::::get_storage(addr, Default::default()).is_ok());
+ assert!(&pallet_contracts::Pallet::::get_storage(
+ addr,
+ pallet_contracts::StorageKey::::default().to_vec()
+ )
+ .is_ok());
});
}
diff --git a/bin/node/executor/tests/common.rs b/bin/node/executor/tests/common.rs
index a2bb91056f474..407a1e09f8efb 100644
--- a/bin/node/executor/tests/common.rs
+++ b/bin/node/executor/tests/common.rs
@@ -35,12 +35,12 @@ use sp_runtime::{
};
use sp_state_machine::TestExternalities as CoreTestExternalities;
-use node_executor::ExecutorDispatch;
-use node_primitives::{BlockNumber, Hash};
-use node_runtime::{
+use kitchensink_runtime::{
constants::currency::*, Block, BuildStorage, CheckedExtrinsic, Header, Runtime,
UncheckedExtrinsic,
};
+use node_executor::ExecutorDispatch;
+use node_primitives::{BlockNumber, Hash};
use node_testing::keyring::*;
use sp_externalities::Externalities;
@@ -69,7 +69,7 @@ impl AppCrypto for TestAuthorityId {
/// making the binary slimmer. There is a convention to use compact version of the runtime
/// as canonical.
pub fn compact_code_unwrap() -> &'static [u8] {
- node_runtime::WASM_BINARY.expect(
+ kitchensink_runtime::WASM_BINARY.expect(
"Development wasm binary is not available. Testing is only supported with the flag \
disabled.",
)
@@ -77,9 +77,9 @@ pub fn compact_code_unwrap() -> &'static [u8] {
pub const GENESIS_HASH: [u8; 32] = [69u8; 32];
-pub const SPEC_VERSION: u32 = node_runtime::VERSION.spec_version;
+pub const SPEC_VERSION: u32 = kitchensink_runtime::VERSION.spec_version;
-pub const TRANSACTION_VERSION: u32 = node_runtime::VERSION.transaction_version;
+pub const TRANSACTION_VERSION: u32 = kitchensink_runtime::VERSION.transaction_version;
pub type TestExternalities = CoreTestExternalities;
diff --git a/bin/node/executor/tests/fees.rs b/bin/node/executor/tests/fees.rs
index cf794bae1d307..008ed5f53927b 100644
--- a/bin/node/executor/tests/fees.rs
+++ b/bin/node/executor/tests/fees.rs
@@ -20,11 +20,11 @@ use frame_support::{
traits::Currency,
weights::{constants::ExtrinsicBaseWeight, GetDispatchInfo, IdentityFee, WeightToFee},
};
-use node_primitives::Balance;
-use node_runtime::{
+use kitchensink_runtime::{
constants::{currency::*, time::SLOT_DURATION},
Balances, Call, CheckedExtrinsic, Multiplier, Runtime, TransactionByteFee, TransactionPayment,
};
+use node_primitives::Balance;
use node_testing::keyring::*;
use sp_core::NeverNativeValue;
use sp_runtime::{traits::One, Perbill};
@@ -58,8 +58,10 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() {
},
CheckedExtrinsic {
signed: Some((charlie(), signed_extra(0, 0))),
- function: Call::System(frame_system::Call::fill_block {
- ratio: Perbill::from_percent(60),
+ function: Call::Sudo(pallet_sudo::Call::sudo {
+ call: Box::new(Call::System(frame_system::Call::fill_block {
+ ratio: Perbill::from_percent(60),
+ })),
}),
},
],
diff --git a/bin/node/executor/tests/submit_transaction.rs b/bin/node/executor/tests/submit_transaction.rs
index 7df13a577006e..be43f3c78674f 100644
--- a/bin/node/executor/tests/submit_transaction.rs
+++ b/bin/node/executor/tests/submit_transaction.rs
@@ -17,7 +17,7 @@
use codec::Decode;
use frame_system::offchain::{SendSignedTransaction, Signer, SubmitTransaction};
-use node_runtime::{Executive, Indices, Runtime, UncheckedExtrinsic};
+use kitchensink_runtime::{Executive, Indices, Runtime, UncheckedExtrinsic};
use sp_application_crypto::AppKey;
use sp_core::offchain::{testing::TestTransactionPoolExt, TransactionPoolExt};
use sp_keyring::sr25519::Keyring::Alice;
diff --git a/bin/node/rpc/Cargo.toml b/bin/node/rpc/Cargo.toml
index 547d0df7a8372..07b25085b9d10 100644
--- a/bin/node/rpc/Cargo.toml
+++ b/bin/node/rpc/Cargo.toml
@@ -11,7 +11,7 @@ repository = "https://github.com/paritytech/substrate/"
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
-jsonrpsee = { version = "0.14.0", features = ["server"] }
+jsonrpsee = { version = "0.15.1", features = ["server"] }
node-primitives = { version = "2.0.0", path = "../primitives" }
pallet-contracts-rpc = { version = "4.0.0-dev", path = "../../../frame/contracts/rpc/" }
pallet-mmr-rpc = { version = "3.0.0", path = "../../../frame/merkle-mountain-range/rpc/" }
diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml
index ca971f29e93c9..10b15b6ec554d 100644
--- a/bin/node/runtime/Cargo.toml
+++ b/bin/node/runtime/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "node-runtime"
+name = "kitchensink-runtime"
version = "3.0.0-dev"
authors = ["Parity Technologies "]
edition = "2021"
@@ -79,6 +79,7 @@ pallet-mmr = { version = "4.0.0-dev", default-features = false, path = "../../..
pallet-multisig = { version = "4.0.0-dev", default-features = false, path = "../../../frame/multisig" }
pallet-nomination-pools = { version = "1.0.0", default-features = false, path = "../../../frame/nomination-pools"}
pallet-nomination-pools-benchmarking = { version = "1.0.0", default-features = false, optional = true, path = "../../../frame/nomination-pools/benchmarking" }
+pallet-nomination-pools-runtime-api = { version = "1.0.0-dev", default-features = false, path = "../../../frame/nomination-pools/runtime-api" }
pallet-offences = { version = "4.0.0-dev", default-features = false, path = "../../../frame/offences" }
pallet-offences-benchmarking = { version = "4.0.0-dev", path = "../../../frame/offences/benchmarking", default-features = false, optional = true }
pallet-preimage = { version = "4.0.0-dev", default-features = false, path = "../../../frame/preimage" }
@@ -145,6 +146,7 @@ std = [
"pallet-mmr/std",
"pallet-multisig/std",
"pallet-nomination-pools/std",
+ "pallet-nomination-pools-runtime-api/std",
"pallet-identity/std",
"pallet-scheduler/std",
"node-primitives/std",
diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs
index addcd0b35a9d9..ff793a49b5ce6 100644
--- a/bin/node/runtime/src/lib.rs
+++ b/bin/node/runtime/src/lib.rs
@@ -47,7 +47,6 @@ use frame_system::{
};
pub use node_primitives::{AccountId, Signature};
use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Index, Moment};
-use pallet_contracts::weights::WeightInfo;
use pallet_election_provider_multi_phase::SolutionAccuracyOf;
use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
@@ -69,7 +68,7 @@ use sp_runtime::{
SaturatedConversion, StaticLookup,
},
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
- ApplyExtrinsicResult, FixedPointNumber, Perbill, Percent, Permill, Perquintill,
+ ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Percent, Permill, Perquintill,
};
use sp_std::prelude::*;
#[cfg(any(feature = "std", test))]
@@ -457,6 +456,7 @@ impl pallet_transaction_payment::Config for Runtime {
}
impl pallet_asset_tx_payment::Config for Runtime {
+ type Event = Event;
type Fungibles = Assets;
type OnChargeAssetTransaction = pallet_asset_tx_payment::FungiblesAdapter<
pallet_assets::BalanceToAssetBalance,
@@ -731,7 +731,7 @@ impl pallet_bags_list::Config for Runtime {
parameter_types! {
pub const PostUnbondPoolsWindow: u32 = 4;
pub const NominationPoolsPalletId: PalletId = PalletId(*b"py/nopls");
- pub const MinPointsToBalance: u32 = 10;
+ pub const MaxPointsToBalance: u8 = 10;
}
use sp_runtime::traits::Convert;
@@ -752,6 +752,8 @@ impl pallet_nomination_pools::Config for Runtime {
type WeightInfo = ();
type Event = Event;
type Currency = Balances;
+ type CurrencyBalance = Balance;
+ type RewardCounter = FixedU128;
type BalanceToU256 = BalanceToU256;
type U256ToBalance = U256ToBalance;
type StakingInterface = pallet_staking::Pallet;
@@ -759,7 +761,7 @@ impl pallet_nomination_pools::Config for Runtime {
type MaxMetadataLen = ConstU32<256>;
type MaxUnbonding = ConstU32<8>;
type PalletId = NominationPoolsPalletId;
- type MinPointsToBalance = MinPointsToBalance;
+ type MaxPointsToBalance = MaxPointsToBalance;
}
parameter_types! {
@@ -964,6 +966,8 @@ parameter_types! {
pub const TermDuration: BlockNumber = 7 * DAYS;
pub const DesiredMembers: u32 = 13;
pub const DesiredRunnersUp: u32 = 7;
+ pub const MaxVoters: u32 = 10 * 1000;
+ pub const MaxCandidates: u32 = 1000;
pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect";
}
@@ -987,6 +991,8 @@ impl pallet_elections_phragmen::Config for Runtime {
type DesiredMembers = DesiredMembers;
type DesiredRunnersUp = DesiredRunnersUp;
type TermDuration = TermDuration;
+ type MaxVoters = MaxVoters;
+ type MaxCandidates = MaxCandidates;
type WeightInfo = pallet_elections_phragmen::weights::SubstrateWeight;
}
@@ -1116,18 +1122,13 @@ parameter_types! {
pub const DepositPerItem: Balance = deposit(1, 0);
pub const DepositPerByte: Balance = deposit(0, 1);
pub const MaxValueSize: u32 = 16 * 1024;
+ pub const DeletionQueueDepth: u32 = 128;
// The lazy deletion runs inside on_initialize.
pub DeletionWeightLimit: Weight = RuntimeBlockWeights::get()
.per_class
.get(DispatchClass::Normal)
.max_total
.unwrap_or(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;
pub Schedule: pallet_contracts::Schedule = Default::default();
}
@@ -1157,6 +1158,7 @@ impl pallet_contracts::Config for Runtime {
type ContractAccessWeight = pallet_contracts::DefaultContractAccessWeight;
type MaxCodeLen = ConstU32<{ 128 * 1024 }>;
type RelaxedMaxCodeLen = ConstU32<{ 256 * 1024 }>;
+ type MaxStorageKeyLen = ConstU32<128>;
}
impl pallet_sudo::Config for Runtime {
@@ -1680,6 +1682,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext,
Runtime,
AllPalletsWithSystem,
+ pallet_nomination_pools::migration::v2::MigrateToV2,
>;
/// MMR helper types.
@@ -1837,6 +1840,12 @@ impl_runtime_apis! {
}
}
+ impl pallet_nomination_pools_runtime_api::NominationPoolsApi for Runtime {
+ fn pending_rewards(member_account: AccountId) -> Balance {
+ NominationPools::pending_rewards(member_account)
+ }
+ }
+
impl sp_consensus_babe::BabeApi for Runtime {
fn configuration() -> sp_consensus_babe::BabeGenesisConfiguration {
// The choice of `c` parameter (where `1 - c` represents the
@@ -1942,7 +1951,7 @@ impl_runtime_apis! {
fn get_storage(
address: AccountId,
- key: [u8; 32],
+ key: Vec,
) -> pallet_contracts_primitives::GetStorageResult {
Contracts::get_storage(address, key)
}
@@ -1960,6 +1969,17 @@ impl_runtime_apis! {
}
}
+ impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi
+ for Runtime
+ {
+ fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo {
+ TransactionPayment::query_call_info(call, len)
+ }
+ fn query_call_fee_details(call: Call, len: u32) -> FeeDetails {
+ TransactionPayment::query_call_fee_details(call, len)
+ }
+ }
+
impl pallet_mmr::primitives::MmrApi<
Block,
mmr::Hash,
diff --git a/bin/node/testing/Cargo.toml b/bin/node/testing/Cargo.toml
index 7caf10366b48c..ed81301e45189 100644
--- a/bin/node/testing/Cargo.toml
+++ b/bin/node/testing/Cargo.toml
@@ -21,7 +21,7 @@ tempfile = "3.1.0"
frame-system = { version = "4.0.0-dev", path = "../../../frame/system" }
node-executor = { version = "3.0.0-dev", path = "../executor" }
node-primitives = { version = "2.0.0", path = "../primitives" }
-node-runtime = { version = "3.0.0-dev", path = "../runtime" }
+kitchensink-runtime = { version = "3.0.0-dev", path = "../runtime" }
pallet-asset-tx-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment/asset-tx-payment" }
pallet-transaction-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment" }
sc-block-builder = { version = "0.10.0-dev", path = "../../../client/block-builder" }
diff --git a/bin/node/testing/src/bench.rs b/bin/node/testing/src/bench.rs
index 00ce7f64bc3f0..de64910125b86 100644
--- a/bin/node/testing/src/bench.rs
+++ b/bin/node/testing/src/bench.rs
@@ -34,11 +34,11 @@ use crate::{
};
use codec::{Decode, Encode};
use futures::executor;
-use node_primitives::Block;
-use node_runtime::{
+use kitchensink_runtime::{
constants::currency::DOLLARS, AccountId, BalancesCall, Call, CheckedExtrinsic, MinimumPeriod,
Signature, SystemCall, UncheckedExtrinsic,
};
+use node_primitives::Block;
use sc_block_builder::BlockBuilderProvider;
use sc_client_api::{
execution_extensions::{ExecutionExtensions, ExecutionStrategies},
@@ -304,20 +304,21 @@ impl<'a> Iterator for BlockContentIterator<'a> {
CheckedExtrinsic {
signed: Some((
sender,
- signed_extra(0, node_runtime::ExistentialDeposit::get() + 1),
+ signed_extra(0, kitchensink_runtime::ExistentialDeposit::get() + 1),
)),
function: match self.content.block_type {
BlockType::RandomTransfersKeepAlive =>
Call::Balances(BalancesCall::transfer_keep_alive {
dest: sp_runtime::MultiAddress::Id(receiver),
- value: node_runtime::ExistentialDeposit::get() + 1,
+ value: kitchensink_runtime::ExistentialDeposit::get() + 1,
}),
BlockType::RandomTransfersReaping => {
Call::Balances(BalancesCall::transfer {
dest: sp_runtime::MultiAddress::Id(receiver),
// Transfer so that ending balance would be 1 less than existential
// deposit so that we kill the sender account.
- value: 100 * DOLLARS - (node_runtime::ExistentialDeposit::get() - 1),
+ value: 100 * DOLLARS -
+ (kitchensink_runtime::ExistentialDeposit::get() - 1),
})
},
BlockType::Noop => Call::System(SystemCall::remark { remark: Vec::new() }),
@@ -391,7 +392,7 @@ impl BenchDb {
state_cache_child_ratio: Some((0, 100)),
state_pruning: Some(PruningMode::ArchiveAll),
source: database_type.into_settings(dir.into()),
- keep_blocks: sc_client_db::KeepBlocks::All,
+ blocks_pruning: sc_client_db::BlocksPruning::All,
};
let task_executor = TaskExecutor::new();
@@ -592,9 +593,9 @@ impl BenchKeyring {
}
/// Generate genesis with accounts from this keyring endowed with some balance.
- pub fn generate_genesis(&self) -> node_runtime::GenesisConfig {
+ pub fn generate_genesis(&self) -> kitchensink_runtime::GenesisConfig {
crate::genesis::config_endowed(
- Some(node_runtime::wasm_binary_unwrap()),
+ Some(kitchensink_runtime::wasm_binary_unwrap()),
self.collect_account_ids(),
)
}
diff --git a/bin/node/testing/src/client.rs b/bin/node/testing/src/client.rs
index 8cb98511098f1..590304bdd52a5 100644
--- a/bin/node/testing/src/client.rs
+++ b/bin/node/testing/src/client.rs
@@ -16,14 +16,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//! Utilities to build a `TestClient` for `node-runtime`.
+//! Utilities to build a `TestClient` for `kitchensink-runtime`.
use sc_service::client;
use sp_runtime::BuildStorage;
/// Re-export test-client utilities.
pub use substrate_test_client::*;
-/// Call executor for `node-runtime` `TestClient`.
+/// Call executor for `kitchensink-runtime` `TestClient`.
pub type ExecutorDispatch = sc_executor::NativeElseWasmExecutor;
/// Default backend type.
@@ -34,10 +34,10 @@ pub type Client = client::Client<
Backend,
client::LocalCallExecutor,
node_primitives::Block,
- node_runtime::RuntimeApi,
+ kitchensink_runtime::RuntimeApi,
>;
-/// Transaction for node-runtime.
+/// Transaction for kitchensink-runtime.
pub type Transaction = sc_client_api::backend::TransactionFor;
/// Genesis configuration parameters for `TestClient`.
diff --git a/bin/node/testing/src/genesis.rs b/bin/node/testing/src/genesis.rs
index fbd28c5af0298..1eb7318db52da 100644
--- a/bin/node/testing/src/genesis.rs
+++ b/bin/node/testing/src/genesis.rs
@@ -19,7 +19,7 @@
//! Genesis Configuration.
use crate::keyring::*;
-use node_runtime::{
+use kitchensink_runtime::{
constants::currency::*, wasm_binary_unwrap, AccountId, BabeConfig, BalancesConfig,
GenesisConfig, GrandpaConfig, IndicesConfig, SessionConfig, SocietyConfig, StakerStatus,
StakingConfig, SystemConfig, BABE_GENESIS_EPOCH_CONFIG,
diff --git a/bin/node/testing/src/keyring.rs b/bin/node/testing/src/keyring.rs
index 41dd28bb89988..88d9dc56b0532 100644
--- a/bin/node/testing/src/keyring.rs
+++ b/bin/node/testing/src/keyring.rs
@@ -19,8 +19,8 @@
//! Test accounts.
use codec::Encode;
+use kitchensink_runtime::{CheckedExtrinsic, SessionKeys, SignedExtra, UncheckedExtrinsic};
use node_primitives::{AccountId, Balance, Index};
-use node_runtime::{CheckedExtrinsic, SessionKeys, SignedExtra, UncheckedExtrinsic};
use sp_keyring::{AccountKeyring, Ed25519Keyring, Sr25519Keyring};
use sp_runtime::generic::Era;
diff --git a/bin/utils/subkey/src/main.rs b/bin/utils/subkey/src/main.rs
index d85c6dbe9d048..271388549bcf9 100644
--- a/bin/utils/subkey/src/main.rs
+++ b/bin/utils/subkey/src/main.rs
@@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//! Subkey utility, based on node_runtime.
+//! Subkey utility, based on kitchensink_runtime.
fn main() -> Result<(), sc_cli::Error> {
subkey::run()
diff --git a/client/allocator/src/freeing_bump.rs b/client/allocator/src/freeing_bump.rs
index 79d6fca6f91b6..13dc6dca0dcd6 100644
--- a/client/allocator/src/freeing_bump.rs
+++ b/client/allocator/src/freeing_bump.rs
@@ -314,27 +314,50 @@ impl IndexMut for FreeLists {
}
}
+/// Memory allocation stats gathered during the lifetime of the allocator.
+#[derive(Clone, Debug, Default)]
+#[non_exhaustive]
+pub struct AllocationStats {
+ /// The current number of bytes allocated.
+ ///
+ /// This represents how many bytes are allocated *right now*.
+ pub bytes_allocated: u32,
+
+ /// The peak number of bytes ever allocated.
+ ///
+ /// This is the maximum the `bytes_allocated` ever reached.
+ pub bytes_allocated_peak: u32,
+
+ /// The sum of every allocation ever made.
+ ///
+ /// This increases every time a new allocation is made.
+ pub bytes_allocated_sum: u32,
+
+ /// The amount of address space (in bytes) used by the allocator.
+ ///
+ /// This is calculated as the difference between the allocator's bumper
+ /// and the heap base.
+ ///
+ /// Currently the bumper's only ever incremented, so this is simultaneously
+ /// the current value as well as the peak value.
+ pub address_space_used: u32,
+}
+
/// An implementation of freeing bump allocator.
///
/// Refer to the module-level documentation for further details.
pub struct FreeingBumpHeapAllocator {
+ original_heap_base: u32,
bumper: u32,
free_lists: FreeLists,
- total_size: u32,
poisoned: bool,
- max_total_size: u32,
- max_bumper: u32,
last_observed_memory_size: u32,
+ stats: AllocationStats,
}
impl Drop for FreeingBumpHeapAllocator {
fn drop(&mut self) {
- log::debug!(
- target: LOG_TARGET,
- "allocator being destroyed, max_total_size {}, max_bumper {}",
- self.max_total_size,
- self.max_bumper,
- )
+ log::debug!(target: LOG_TARGET, "allocator dropped: {:?}", self.stats)
}
}
@@ -348,13 +371,12 @@ impl FreeingBumpHeapAllocator {
let aligned_heap_base = (heap_base + ALIGNMENT - 1) / ALIGNMENT * ALIGNMENT;
FreeingBumpHeapAllocator {
+ original_heap_base: aligned_heap_base,
bumper: aligned_heap_base,
free_lists: FreeLists::new(),
- total_size: 0,
poisoned: false,
- max_total_size: 0,
- max_bumper: aligned_heap_base,
last_observed_memory_size: 0,
+ stats: AllocationStats::default(),
}
}
@@ -412,22 +434,13 @@ impl FreeingBumpHeapAllocator {
// Write the order in the occupied header.
Header::Occupied(order).write_into(mem, header_ptr)?;
- self.total_size += order.size() + HEADER_SIZE;
-
- log::trace!(
- target: LOG_TARGET,
- "after allocation, total_size = {}, bumper = {}.",
- self.total_size,
- self.bumper,
- );
+ self.stats.bytes_allocated += order.size() + HEADER_SIZE;
+ self.stats.bytes_allocated_sum += order.size() + HEADER_SIZE;
+ self.stats.bytes_allocated_peak =
+ std::cmp::max(self.stats.bytes_allocated_peak, self.stats.bytes_allocated);
+ self.stats.address_space_used = self.bumper - self.original_heap_base;
- // update trackers if needed.
- if self.total_size > self.max_total_size {
- self.max_total_size = self.total_size;
- }
- if self.bumper > self.max_bumper {
- self.max_bumper = self.bumper;
- }
+ log::trace!(target: LOG_TARGET, "after allocation: {:?}", self.stats);
bomb.disarm();
Ok(Pointer::new(header_ptr + HEADER_SIZE))
@@ -469,21 +482,23 @@ impl FreeingBumpHeapAllocator {
let prev_head = self.free_lists.replace(order, Link::Ptr(header_ptr));
Header::Free(prev_head).write_into(mem, header_ptr)?;
- // Do the total_size book keeping.
- self.total_size = self
- .total_size
+ self.stats.bytes_allocated = self
+ .stats
+ .bytes_allocated
.checked_sub(order.size() + HEADER_SIZE)
- .ok_or_else(|| error("Unable to subtract from total heap size without overflow"))?;
- log::trace!(
- "after deallocation, total_size = {}, bumper = {}.",
- self.total_size,
- self.bumper,
- );
+ .ok_or_else(|| error("underflow of the currently allocated bytes count"))?;
+
+ log::trace!("after deallocation: {:?}", self.stats);
bomb.disarm();
Ok(())
}
+ /// Returns the allocation stats for this allocator.
+ pub fn stats(&self) -> AllocationStats {
+ self.stats.clone()
+ }
+
/// Increases the `bumper` by `size`.
///
/// Returns the `bumper` from before the increase. Returns an `Error::AllocatorOutOfSpace` if
@@ -791,13 +806,13 @@ mod tests {
let ptr1 = heap.allocate(&mut mem[..], 32).unwrap();
assert_eq!(ptr1, to_pointer(HEADER_SIZE));
heap.deallocate(&mut mem[..], ptr1).expect("failed freeing ptr1");
- assert_eq!(heap.total_size, 0);
+ assert_eq!(heap.stats.bytes_allocated, 0);
assert_eq!(heap.bumper, 40);
let ptr2 = heap.allocate(&mut mem[..], 16).unwrap();
assert_eq!(ptr2, to_pointer(48));
heap.deallocate(&mut mem[..], ptr2).expect("failed freeing ptr2");
- assert_eq!(heap.total_size, 0);
+ assert_eq!(heap.stats.bytes_allocated, 0);
assert_eq!(heap.bumper, 64);
// when
@@ -825,7 +840,7 @@ mod tests {
heap.allocate(&mut mem[..], 9).unwrap();
// then
- assert_eq!(heap.total_size, HEADER_SIZE + 16);
+ assert_eq!(heap.stats.bytes_allocated, HEADER_SIZE + 16);
}
#[test]
@@ -840,7 +855,7 @@ mod tests {
heap.deallocate(&mut mem[..], ptr).unwrap();
// then
- assert_eq!(heap.total_size, 0);
+ assert_eq!(heap.stats.bytes_allocated, 0);
}
#[test]
@@ -856,7 +871,7 @@ mod tests {
}
// then
- assert_eq!(heap.total_size, 0);
+ assert_eq!(heap.stats.bytes_allocated, 0);
}
#[test]
diff --git a/client/allocator/src/lib.rs b/client/allocator/src/lib.rs
index 2c3e3b2ae841d..2fe63a1ec392c 100644
--- a/client/allocator/src/lib.rs
+++ b/client/allocator/src/lib.rs
@@ -26,4 +26,4 @@ mod error;
mod freeing_bump;
pub use error::Error;
-pub use freeing_bump::FreeingBumpHeapAllocator;
+pub use freeing_bump::{AllocationStats, FreeingBumpHeapAllocator};
diff --git a/client/api/src/backend.rs b/client/api/src/backend.rs
index af8552886b72e..54784a2f27b64 100644
--- a/client/api/src/backend.rs
+++ b/client/api/src/backend.rs
@@ -507,7 +507,8 @@ pub trait Backend: AuxStore + Send + Sync {
/// Attempts to revert the chain by `n` blocks. If `revert_finalized` is set it will attempt to
/// revert past any finalized block, this is unsafe and can potentially leave the node in an
- /// inconsistent state.
+ /// inconsistent state. All blocks higher than the best block are also reverted and not counting
+ /// towards `n`.
///
/// Returns the number of blocks that were successfully reverted and the list of finalized
/// blocks that has been reverted.
diff --git a/client/api/src/leaves.rs b/client/api/src/leaves.rs
index 5859290777433..26eda46e6f76f 100644
--- a/client/api/src/leaves.rs
+++ b/client/api/src/leaves.rs
@@ -67,8 +67,6 @@ impl FinalizationDisplaced {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct LeafSet {
storage: BTreeMap, Vec>,
- pending_added: Vec<(H, N)>,
- pending_removed: Vec,
}
impl LeafSet
@@ -78,7 +76,7 @@ where
{
/// Construct a new, blank leaf set.
pub fn new() -> Self {
- Self { storage: BTreeMap::new(), pending_added: Vec::new(), pending_removed: Vec::new() }
+ Self { storage: BTreeMap::new() }
}
/// Read the leaf list from the DB, using given prefix for keys.
@@ -97,21 +95,21 @@ where
},
None => {},
}
- Ok(Self { storage, pending_added: Vec::new(), pending_removed: Vec::new() })
+ Ok(Self { storage })
}
- /// update the leaf list on import. returns a displaced leaf if there was one.
+ /// Update the leaf list on import.
+ /// Returns a displaced leaf if there was one.
pub fn import(&mut self, hash: H, number: N, parent_hash: H) -> Option> {
// avoid underflow for genesis.
let displaced = if number != N::zero() {
- let new_number = Reverse(number.clone() - N::one());
- let was_displaced = self.remove_leaf(&new_number, &parent_hash);
+ let parent_number = Reverse(number.clone() - N::one());
+ let was_displaced = self.remove_leaf(&parent_number, &parent_hash);
if was_displaced {
- self.pending_removed.push(parent_hash.clone());
Some(ImportDisplaced {
new_hash: hash.clone(),
- displaced: LeafSetItem { hash: parent_hash, number: new_number },
+ displaced: LeafSetItem { hash: parent_hash, number: parent_number },
})
} else {
None
@@ -121,7 +119,6 @@ where
};
self.insert_leaf(Reverse(number.clone()), hash.clone());
- self.pending_added.push((hash, number));
displaced
}
@@ -140,8 +137,6 @@ where
};
let below_boundary = self.storage.split_off(&Reverse(boundary));
- self.pending_removed
- .extend(below_boundary.values().flat_map(|h| h.iter()).cloned());
FinalizationDisplaced { leaves: below_boundary }
}
@@ -188,8 +183,6 @@ where
self.remove_leaf(number, hash),
"item comes from an iterator over storage; qed",
);
-
- self.pending_removed.push(hash.clone());
}
}
@@ -203,7 +196,6 @@ where
// this is an invariant of regular block import.
if !leaves_contains_best {
self.insert_leaf(best_number.clone(), best_hash.clone());
- self.pending_added.push((best_hash, best_number.0));
}
}
@@ -213,9 +205,9 @@ where
self.storage.iter().flat_map(|(_, hashes)| hashes.iter()).cloned().collect()
}
- /// Number of known leaves
+ /// Number of known leaves.
pub fn count(&self) -> usize {
- self.storage.len()
+ self.storage.values().map(|level| level.len()).sum()
}
/// Write the leaf list to the database transaction.
@@ -227,8 +219,6 @@ where
) {
let leaves: Vec<_> = self.storage.iter().map(|(n, h)| (n.0.clone(), h.clone())).collect();
tx.set_from_vec(column, prefix, leaves.encode());
- self.pending_added.clear();
- self.pending_removed.clear();
}
/// Check if given block is a leaf.
@@ -242,7 +232,7 @@ where
self.storage.entry(number).or_insert_with(Vec::new).push(hash);
}
- // returns true if this leaf was contained, false otherwise.
+ // Returns true if this leaf was contained, false otherwise.
fn remove_leaf(&mut self, number: &Reverse, hash: &H) -> bool {
let mut empty = false;
let removed = self.storage.get_mut(number).map_or(false, |leaves| {
@@ -269,6 +259,11 @@ where
removed
}
+
+ /// Returns the highest leaf and all hashes associated to it.
+ pub fn highest_leaf(&self) -> Option<(N, &[H])> {
+ self.storage.iter().next().map(|(k, v)| (k.0.clone(), &v[..]))
+ }
}
/// Helper for undoing operations.
@@ -285,7 +280,7 @@ where
pub fn undo_import(&mut self, displaced: ImportDisplaced) {
let new_number = Reverse(displaced.displaced.number.0.clone() + N::one());
self.inner.remove_leaf(&new_number, &displaced.new_hash);
- self.inner.insert_leaf(new_number, displaced.displaced.hash);
+ self.inner.insert_leaf(displaced.displaced.number, displaced.displaced.hash);
}
/// Undo a finalization operation by providing the displaced leaves.
@@ -294,13 +289,6 @@ where
}
}
-impl<'a, H: 'a, N: 'a> Drop for Undo<'a, H, N> {
- fn drop(&mut self) {
- self.inner.pending_added.clear();
- self.inner.pending_removed.clear();
- }
-}
-
#[cfg(test)]
mod tests {
use super::*;
@@ -315,15 +303,20 @@ mod tests {
set.import(2_1, 2, 1_1);
set.import(3_1, 3, 2_1);
+ assert_eq!(set.count(), 1);
assert!(set.contains(3, 3_1));
assert!(!set.contains(2, 2_1));
assert!(!set.contains(1, 1_1));
assert!(!set.contains(0, 0));
set.import(2_2, 2, 1_1);
+ set.import(1_2, 1, 0);
+ set.import(2_3, 2, 1_2);
+ assert_eq!(set.count(), 3);
assert!(set.contains(3, 3_1));
assert!(set.contains(2, 2_2));
+ assert!(set.contains(2, 2_3));
}
#[test]
@@ -392,17 +385,42 @@ mod tests {
}
#[test]
- fn undo_finalization() {
+ fn undo_import() {
let mut set = LeafSet::new();
set.import(10_1u32, 10u32, 0u32);
- set.import(11_1, 11, 10_2);
- set.import(11_2, 11, 10_2);
- set.import(12_1, 12, 11_123);
+ set.import(11_1, 11, 10_1);
+ set.import(11_2, 11, 10_1);
+
+ let displaced = set.import(12_1, 12, 11_1).unwrap();
+ assert_eq!(set.count(), 2);
+ assert!(set.contains(11, 11_2));
+ assert!(set.contains(12, 12_1));
+
+ set.undo().undo_import(displaced);
+ assert_eq!(set.count(), 2);
+ assert!(set.contains(11, 11_1));
+ assert!(set.contains(11, 11_2));
+ }
+
+ #[test]
+ fn undo_finalization() {
+ let mut set = LeafSet::new();
+ set.import(9_1u32, 9u32, 0u32);
+ set.import(10_1, 10, 9_1);
+ set.import(10_2, 10, 9_1);
+ set.import(11_1, 11, 10_1);
+ set.import(11_2, 11, 10_1);
+ set.import(12_1, 12, 11_2);
let displaced = set.finalize_height(11);
- assert!(!set.contains(10, 10_1));
+ assert_eq!(set.count(), 2);
+ assert!(set.contains(11, 11_1));
+ assert!(set.contains(12, 12_1));
set.undo().undo_finalization(displaced);
- assert!(set.contains(10, 10_1));
+ assert_eq!(set.count(), 3);
+ assert!(set.contains(11, 11_1));
+ assert!(set.contains(12, 12_1));
+ assert!(set.contains(10, 10_2));
}
}
diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml
index 32a5e23bd49d9..544df4c8d4812 100644
--- a/client/authority-discovery/Cargo.toml
+++ b/client/authority-discovery/Cargo.toml
@@ -17,18 +17,18 @@ targets = ["x86_64-unknown-linux-gnu"]
prost-build = "0.10"
[dependencies]
-async-trait = "0.1"
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
futures = "0.3.21"
futures-timer = "3.0.1"
ip_network = "0.4.1"
-libp2p = { version = "0.45.1", default-features = false, features = ["kad"] }
+libp2p = { version = "0.46.1", default-features = false, features = ["kad"] }
log = "0.4.17"
prost = "0.10"
rand = "0.7.2"
thiserror = "1.0"
prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.10.0-dev", path = "../../utils/prometheus" }
sc-client-api = { version = "4.0.0-dev", path = "../api" }
+sc-network-common = { version = "0.10.0-dev", path = "../network/common" }
sc-network = { version = "0.10.0-dev", path = "../network" }
sp-api = { version = "4.0.0-dev", path = "../../primitives/api" }
sp-authority-discovery = { version = "4.0.0-dev", path = "../../primitives/authority-discovery" }
diff --git a/client/authority-discovery/src/lib.rs b/client/authority-discovery/src/lib.rs
index 8522da9984a6f..f0ef374551617 100644
--- a/client/authority-discovery/src/lib.rs
+++ b/client/authority-discovery/src/lib.rs
@@ -39,8 +39,9 @@ use futures::{
Stream,
};
+use libp2p::{Multiaddr, PeerId};
use sc_client_api::blockchain::HeaderBackend;
-use sc_network::{DhtEvent, Multiaddr, PeerId};
+use sc_network_common::protocol::event::DhtEvent;
use sp_api::ProvideRuntimeApi;
use sp_authority_discovery::{AuthorityDiscoveryApi, AuthorityId};
use sp_runtime::traits::Block as BlockT;
diff --git a/client/authority-discovery/src/service.rs b/client/authority-discovery/src/service.rs
index c240e5d0c2287..df09b6ea43216 100644
--- a/client/authority-discovery/src/service.rs
+++ b/client/authority-discovery/src/service.rs
@@ -25,7 +25,7 @@ use futures::{
SinkExt,
};
-use sc_network::{Multiaddr, PeerId};
+use libp2p::{Multiaddr, PeerId};
use sp_authority_discovery::AuthorityId;
/// Service to interact with the [`crate::Worker`].
diff --git a/client/authority-discovery/src/tests.rs b/client/authority-discovery/src/tests.rs
index e9f94b6a186db..334b2638ca58c 100644
--- a/client/authority-discovery/src/tests.rs
+++ b/client/authority-discovery/src/tests.rs
@@ -87,12 +87,12 @@ fn get_addresses_and_authority_id() {
fn cryptos_are_compatible() {
use sp_core::crypto::Pair;
- let libp2p_secret = sc_network::Keypair::generate_ed25519();
+ let libp2p_secret = libp2p::identity::Keypair::generate_ed25519();
let libp2p_public = libp2p_secret.public();
let sp_core_secret = {
let libp2p_ed_secret = match libp2p_secret.clone() {
- sc_network::Keypair::Ed25519(x) => x,
+ libp2p::identity::Keypair::Ed25519(x) => x,
_ => panic!("generate_ed25519 should have generated an Ed25519 key ¯\\_(ツ)_/¯"),
};
sp_core::ed25519::Pair::from_seed_slice(&libp2p_ed_secret.secret().as_ref()).unwrap()
diff --git a/client/authority-discovery/src/worker.rs b/client/authority-discovery/src/worker.rs
index 87cc72ba7a69c..f13a1cf33581b 100644
--- a/client/authority-discovery/src/worker.rs
+++ b/client/authority-discovery/src/worker.rs
@@ -32,19 +32,22 @@ use std::{
use futures::{channel::mpsc, future, stream::Fuse, FutureExt, Stream, StreamExt};
use addr_cache::AddrCache;
-use async_trait::async_trait;
use codec::Decode;
use ip_network::IpNetwork;
use libp2p::{
core::multiaddr,
multihash::{Multihash, MultihashDigest},
+ Multiaddr, PeerId,
};
use log::{debug, error, log_enabled};
use prometheus_endpoint::{register, Counter, CounterVec, Gauge, Opts, U64};
use prost::Message;
use rand::{seq::SliceRandom, thread_rng};
use sc_client_api::blockchain::HeaderBackend;
-use sc_network::{DhtEvent, ExHashT, Multiaddr, NetworkStateInfo, PeerId};
+use sc_network_common::{
+ protocol::event::DhtEvent,
+ service::{KademliaKey, NetworkDHTProvider, NetworkSigner, NetworkStateInfo, Signature},
+};
use sp_api::ProvideRuntimeApi;
use sp_authority_discovery::{
AuthorityDiscoveryApi, AuthorityId, AuthorityPair, AuthoritySignature,
@@ -136,7 +139,7 @@ pub struct Worker {
/// Queue of throttled lookups pending to be passed to the network.
pending_lookups: Vec,
/// Set of in-flight lookups.
- in_flight_lookups: HashMap,
+ in_flight_lookups: HashMap,
addr_cache: addr_cache::AddrCache,
@@ -464,10 +467,7 @@ where
}
}
- fn handle_dht_value_found_event(
- &mut self,
- values: Vec<(sc_network::KademliaKey, Vec)>,
- ) -> Result<()> {
+ fn handle_dht_value_found_event(&mut self, values: Vec<(KademliaKey, Vec)>) -> Result<()> {
// Ensure `values` is not empty and all its keys equal.
let remote_key = single(values.iter().map(|(key, _)| key.clone()))
.map_err(|_| Error::ReceivingDhtValueFoundEventWithDifferentKeys)?
@@ -523,11 +523,11 @@ where
// properly signed by the owner of the PeerId
if let Some(peer_signature) = peer_signature {
- let public_key =
- sc_network::PublicKey::from_protobuf_encoding(&peer_signature.public_key)
- .map_err(Error::ParsingLibp2pIdentity)?;
- let signature =
- sc_network::Signature { public_key, bytes: peer_signature.signature };
+ let public_key = libp2p::identity::PublicKey::from_protobuf_encoding(
+ &peer_signature.public_key,
+ )
+ .map_err(Error::ParsingLibp2pIdentity)?;
+ let signature = Signature { public_key, bytes: peer_signature.signature };
if !signature.verify(record, &remote_peer_id) {
return Err(Error::VerifyingDhtPayload)
@@ -590,55 +590,15 @@ where
}
}
-pub trait NetworkSigner {
- /// Sign a message in the name of `self.local_peer_id()`
- fn sign_with_local_identity(
- &self,
- msg: impl AsRef<[u8]>,
- ) -> std::result::Result;
-}
-
/// NetworkProvider provides [`Worker`] with all necessary hooks into the
/// underlying Substrate networking. Using this trait abstraction instead of
-/// [`sc_network::NetworkService`] directly is necessary to unit test [`Worker`].
-#[async_trait]
-pub trait NetworkProvider: NetworkStateInfo + NetworkSigner {
- /// Start putting a value in the Dht.
- fn put_value(&self, key: sc_network::KademliaKey, value: Vec);
-
- /// Start getting a value from the Dht.
- fn get_value(&self, key: &sc_network::KademliaKey);
-}
+/// `sc_network::NetworkService` directly is necessary to unit test [`Worker`].
+pub trait NetworkProvider: NetworkDHTProvider + NetworkStateInfo + NetworkSigner {}
-impl NetworkSigner for sc_network::NetworkService
-where
- B: BlockT + 'static,
- H: ExHashT,
-{
- fn sign_with_local_identity(
- &self,
- msg: impl AsRef<[u8]>,
- ) -> std::result::Result {
- self.sign_with_local_identity(msg)
- }
-}
-
-#[async_trait::async_trait]
-impl NetworkProvider for sc_network::NetworkService
-where
- B: BlockT + 'static,
- H: ExHashT,
-{
- fn put_value(&self, key: sc_network::KademliaKey, value: Vec) {
- self.put_value(key, value)
- }
- fn get_value(&self, key: &sc_network::KademliaKey) {
- self.get_value(key)
- }
-}
+impl NetworkProvider for T where T: NetworkDHTProvider + NetworkStateInfo + NetworkSigner {}
-fn hash_authority_id(id: &[u8]) -> sc_network::KademliaKey {
- sc_network::KademliaKey::new(&libp2p::multihash::Code::Sha2_256.digest(id).digest())
+fn hash_authority_id(id: &[u8]) -> KademliaKey {
+ KademliaKey::new(&libp2p::multihash::Code::Sha2_256.digest(id).digest())
}
// Makes sure all values are the same and returns it
@@ -685,7 +645,7 @@ async fn sign_record_with_authority_ids(
peer_signature: Option,
key_store: &dyn CryptoStore,
keys: Vec,
-) -> Result)>> {
+) -> Result)>> {
let signatures = key_store
.sign_with_all(key_types::AUTHORITY_DISCOVERY, keys.clone(), &serialized_record)
.await
diff --git a/client/authority-discovery/src/worker/addr_cache.rs b/client/authority-discovery/src/worker/addr_cache.rs
index f768b9c4e66a7..19bbbf0b62e7e 100644
--- a/client/authority-discovery/src/worker/addr_cache.rs
+++ b/client/authority-discovery/src/worker/addr_cache.rs
@@ -16,9 +16,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use libp2p::core::multiaddr::{Multiaddr, Protocol};
-
-use sc_network::PeerId;
+use libp2p::{
+ core::multiaddr::{Multiaddr, Protocol},
+ PeerId,
+};
use sp_authority_discovery::AuthorityId;
use std::collections::{hash_map::Entry, HashMap, HashSet};
diff --git a/client/authority-discovery/src/worker/schema/tests.rs b/client/authority-discovery/src/worker/schema/tests.rs
index b85a4ce37447d..60147d6762e50 100644
--- a/client/authority-discovery/src/worker/schema/tests.rs
+++ b/client/authority-discovery/src/worker/schema/tests.rs
@@ -21,9 +21,8 @@ mod schema_v1 {
}
use super::*;
-use libp2p::multiaddr::Multiaddr;
+use libp2p::{multiaddr::Multiaddr, PeerId};
use prost::Message;
-use sc_network::PeerId;
#[test]
fn v2_decodes_v1() {
@@ -56,7 +55,7 @@ fn v2_decodes_v1() {
#[test]
fn v1_decodes_v2() {
- let peer_secret = sc_network::Keypair::generate_ed25519();
+ let peer_secret = libp2p::identity::Keypair::generate_ed25519();
let peer_public = peer_secret.public();
let peer_id = peer_public.to_peer_id();
let multiaddress: Multiaddr =
diff --git a/client/authority-discovery/src/worker/tests.rs b/client/authority-discovery/src/worker/tests.rs
index a1a699bc30dd2..5a60d3353db52 100644
--- a/client/authority-discovery/src/worker/tests.rs
+++ b/client/authority-discovery/src/worker/tests.rs
@@ -22,7 +22,6 @@ use std::{
task::Poll,
};
-use async_trait::async_trait;
use futures::{
channel::mpsc::{self, channel},
executor::{block_on, LocalPool},
@@ -30,9 +29,10 @@ use futures::{
sink::SinkExt,
task::LocalSpawn,
};
-use libp2p::{core::multiaddr, PeerId};
+use libp2p::{core::multiaddr, identity::Keypair, PeerId};
use prometheus_endpoint::prometheus::default_registry;
+use sc_network_common::service::{KademliaKey, Signature, SigningError};
use sp_api::{ApiRef, ProvideRuntimeApi};
use sp_keystore::{testing::KeyStore, CryptoStore};
use sp_runtime::traits::{Block as BlockT, NumberFor, Zero};
@@ -111,18 +111,18 @@ sp_api::mock_impl_runtime_apis! {
#[derive(Debug)]
pub enum TestNetworkEvent {
- GetCalled(sc_network::KademliaKey),
- PutCalled(sc_network::KademliaKey, Vec),
+ GetCalled(KademliaKey),
+ PutCalled(KademliaKey, Vec),
}
pub struct TestNetwork {
peer_id: PeerId,
- identity: sc_network::Keypair,
+ identity: Keypair,
external_addresses: Vec,
// Whenever functions on `TestNetwork` are called, the function arguments are added to the
// vectors below.
- pub put_value_call: Arc)>>>,
- pub get_value_call: Arc>>,
+ pub put_value_call: Arc)>>>,
+ pub get_value_call: Arc>>,
event_sender: mpsc::UnboundedSender,
event_receiver: Option>,
}
@@ -136,7 +136,7 @@ impl TestNetwork {
impl Default for TestNetwork {
fn default() -> Self {
let (tx, rx) = mpsc::unbounded();
- let identity = sc_network::Keypair::generate_ed25519();
+ let identity = Keypair::generate_ed25519();
TestNetwork {
peer_id: identity.public().to_peer_id(),
identity,
@@ -153,21 +153,20 @@ impl NetworkSigner for TestNetwork {
fn sign_with_local_identity(
&self,
msg: impl AsRef<[u8]>,
- ) -> std::result::Result {
- sc_network::Signature::sign_message(msg, &self.identity)
+ ) -> std::result::Result {
+ Signature::sign_message(msg, &self.identity)
}
}
-#[async_trait]
-impl NetworkProvider for TestNetwork {
- fn put_value(&self, key: sc_network::KademliaKey, value: Vec) {
+impl NetworkDHTProvider for TestNetwork {
+ fn put_value(&self, key: KademliaKey, value: Vec) {
self.put_value_call.lock().unwrap().push((key.clone(), value.clone()));
self.event_sender
.clone()
.unbounded_send(TestNetworkEvent::PutCalled(key, value))
.unwrap();
}
- fn get_value(&self, key: &sc_network::KademliaKey) {
+ fn get_value(&self, key: &KademliaKey) {
self.get_value_call.lock().unwrap().push(key.clone());
self.event_sender
.clone()
@@ -186,12 +185,16 @@ impl NetworkStateInfo for TestNetwork {
}
}
-impl NetworkSigner for sc_network::Keypair {
+struct TestSigner<'a> {
+ keypair: &'a Keypair,
+}
+
+impl<'a> NetworkSigner for TestSigner<'a> {
fn sign_with_local_identity(
&self,
msg: impl AsRef<[u8]>,
- ) -> std::result::Result {
- sc_network::Signature::sign_message(msg, self)
+ ) -> std::result::Result {
+ Signature::sign_message(msg, self.keypair)
}
}
@@ -200,7 +203,7 @@ async fn build_dht_event(
public_key: AuthorityId,
key_store: &dyn CryptoStore,
network: Option<&Signer>,
-) -> Vec<(sc_network::KademliaKey, Vec)> {
+) -> Vec<(KademliaKey, Vec)> {
let serialized_record =
serialize_authority_record(serialize_addresses(addresses.into_iter())).unwrap();
@@ -313,7 +316,7 @@ fn publish_discover_cycle() {
let dht_event = {
let (key, value) = network.put_value_call.lock().unwrap().pop().unwrap();
- sc_network::DhtEvent::ValueFound(vec![(key, value)])
+ DhtEvent::ValueFound(vec![(key, value)])
};
// Node B discovering node A's address.
@@ -469,7 +472,7 @@ fn dont_stop_polling_dht_event_stream_after_bogus_event() {
None,
)
.await;
- sc_network::DhtEvent::ValueFound(kv_pairs)
+ DhtEvent::ValueFound(kv_pairs)
};
dht_event_tx.send(dht_event).await.expect("Channel has capacity of 1.");
@@ -487,7 +490,7 @@ fn dont_stop_polling_dht_event_stream_after_bogus_event() {
struct DhtValueFoundTester {
pub remote_key_store: KeyStore,
pub remote_authority_public: sp_core::sr25519::Public,
- pub remote_node_key: sc_network::Keypair,
+ pub remote_node_key: Keypair,
pub local_worker: Option<
Worker<
TestApi,
@@ -496,7 +499,7 @@ struct DhtValueFoundTester {
sp_runtime::generic::Header,
substrate_test_runtime_client::runtime::Extrinsic,
>,
- std::pin::Pin>>,
+ std::pin::Pin>>,
>,
>,
}
@@ -508,7 +511,7 @@ impl DhtValueFoundTester {
block_on(remote_key_store.sr25519_generate_new(key_types::AUTHORITY_DISCOVERY, None))
.unwrap();
- let remote_node_key = sc_network::Keypair::generate_ed25519();
+ let remote_node_key = Keypair::generate_ed25519();
Self { remote_key_store, remote_authority_public, remote_node_key, local_worker: None }
}
@@ -523,7 +526,7 @@ impl DhtValueFoundTester {
fn process_value_found(
&mut self,
strict_record_validation: bool,
- values: Vec<(sc_network::KademliaKey, Vec)>,
+ values: Vec<(KademliaKey, Vec)>,
) -> Option<&HashSet> {
let (_dht_event_tx, dht_event_rx) = channel(1);
let local_test_api =
@@ -583,7 +586,7 @@ fn strict_accept_address_with_peer_signature() {
vec![addr.clone()],
tester.remote_authority_public.clone().into(),
&tester.remote_key_store,
- Some(&tester.remote_node_key),
+ Some(&TestSigner { keypair: &tester.remote_node_key }),
));
let cached_remote_addresses = tester.process_value_found(true, kv_pairs);
@@ -598,12 +601,12 @@ fn strict_accept_address_with_peer_signature() {
#[test]
fn reject_address_with_rogue_peer_signature() {
let mut tester = DhtValueFoundTester::new();
- let rogue_remote_node_key = sc_network::Keypair::generate_ed25519();
+ let rogue_remote_node_key = Keypair::generate_ed25519();
let kv_pairs = block_on(build_dht_event(
vec![tester.multiaddr_with_peer_id(1)],
tester.remote_authority_public.clone().into(),
&tester.remote_key_store,
- Some(&rogue_remote_node_key),
+ Some(&TestSigner { keypair: &rogue_remote_node_key }),
));
let cached_remote_addresses = tester.process_value_found(false, kv_pairs);
@@ -621,7 +624,7 @@ fn reject_address_with_invalid_peer_signature() {
vec![tester.multiaddr_with_peer_id(1)],
tester.remote_authority_public.clone().into(),
&tester.remote_key_store,
- Some(&tester.remote_node_key),
+ Some(&TestSigner { keypair: &tester.remote_node_key }),
));
// tamper with the signature
let mut record = schema::SignedAuthorityRecord::decode(kv_pairs[0].1.as_slice()).unwrap();
@@ -808,7 +811,7 @@ fn lookup_throttling() {
None,
)
.await;
- sc_network::DhtEvent::ValueFound(kv_pairs)
+ DhtEvent::ValueFound(kv_pairs)
};
dht_event_tx.send(dht_event).await.expect("Channel has capacity of 1.");
@@ -822,7 +825,7 @@ fn lookup_throttling() {
// Make second one fail.
let remote_hash = network.get_value_call.lock().unwrap().pop().unwrap();
- let dht_event = sc_network::DhtEvent::ValueNotFound(remote_hash);
+ let dht_event = DhtEvent::ValueNotFound(remote_hash);
dht_event_tx.send(dht_event).await.expect("Channel has capacity of 1.");
// Assert worker to trigger another lookup.
diff --git a/client/basic-authorship/src/basic_authorship.rs b/client/basic-authorship/src/basic_authorship.rs
index b67008bc6f44b..bc328c40edb3c 100644
--- a/client/basic-authorship/src/basic_authorship.rs
+++ b/client/basic-authorship/src/basic_authorship.rs
@@ -34,9 +34,7 @@ use sc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_INFO};
use sc_transaction_pool_api::{InPoolTransaction, TransactionPool};
use sp_api::{ApiExt, ProvideRuntimeApi};
use sp_blockchain::{ApplyExtrinsicFailed::Validity, Error::ApplyExtrinsicFailed, HeaderBackend};
-use sp_consensus::{
- evaluation, DisableProofRecording, EnableProofRecording, ProofRecording, Proposal,
-};
+use sp_consensus::{DisableProofRecording, EnableProofRecording, ProofRecording, Proposal};
use sp_core::traits::SpawnNamed;
use sp_inherents::InherentData;
use sp_runtime::{
@@ -205,7 +203,6 @@ where
let proposer = Proposer::<_, _, _, _, PR> {
spawn_handle: self.spawn_handle.clone(),
client: self.client.clone(),
- parent_hash,
parent_id: id,
parent_number: *parent_header.number(),
transaction_pool: self.transaction_pool.clone(),
@@ -250,7 +247,6 @@ where
pub struct Proposer {
spawn_handle: Box,
client: Arc,
- parent_hash: ::Hash,
parent_id: BlockId,
parent_number: <::Header as HeaderT>::Number,
transaction_pool: Arc,
@@ -536,12 +532,6 @@ where
"hash" => ?::Hash::from(block.header().hash()),
);
- if let Err(err) =
- evaluation::evaluate_initial(&block, &self.parent_hash, self.parent_number)
- {
- error!("Failed to evaluate authored block: {:?}", err);
- }
-
let proof =
PR::into_proof(proof).map_err(|e| sp_blockchain::Error::Application(Box::new(e)))?;
diff --git a/client/beefy/Cargo.toml b/client/beefy/Cargo.toml
index bd25496f2dfea..e219420959c9f 100644
--- a/client/beefy/Cargo.toml
+++ b/client/beefy/Cargo.toml
@@ -9,6 +9,7 @@ description = "BEEFY Client gadget for substrate"
homepage = "https://substrate.io"
[dependencies]
+async-trait = "0.1.50"
codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"] }
fnv = "1.0.6"
futures = "0.3"
@@ -22,6 +23,7 @@ beefy-primitives = { version = "4.0.0-dev", path = "../../primitives/beefy" }
prometheus = { package = "substrate-prometheus-endpoint", version = "0.10.0-dev", path = "../../utils/prometheus" }
sc-chain-spec = { version = "4.0.0-dev", path = "../../client/chain-spec" }
sc-client-api = { version = "4.0.0-dev", path = "../api" }
+sc-consensus = { version = "0.10.0-dev", path = "../consensus/common" }
sc-finality-grandpa = { version = "0.10.0-dev", path = "../../client/finality-grandpa" }
sc-keystore = { version = "4.0.0-dev", path = "../keystore" }
sc-network = { version = "0.10.0-dev", path = "../network" }
@@ -39,10 +41,10 @@ sp-runtime = { version = "6.0.0", path = "../../primitives/runtime" }
[dev-dependencies]
serde = "1.0.136"
-strum = { version = "0.23", features = ["derive"] }
+strum = { version = "0.24.1", features = ["derive"] }
tempfile = "3.1.0"
tokio = "1.17.0"
-sc-consensus = { version = "0.10.0-dev", path = "../consensus/common" }
+sc-block-builder = { version = "0.10.0-dev", path = "../block-builder" }
sc-network-test = { version = "0.8.0", path = "../network/test" }
sp-finality-grandpa = { version = "4.0.0-dev", path = "../../primitives/finality-grandpa" }
sp-keyring = { version = "6.0.0", path = "../../primitives/keyring" }
diff --git a/client/beefy/rpc/Cargo.toml b/client/beefy/rpc/Cargo.toml
index 7d31aea3f6971..46ee7640d710a 100644
--- a/client/beefy/rpc/Cargo.toml
+++ b/client/beefy/rpc/Cargo.toml
@@ -11,7 +11,7 @@ homepage = "https://substrate.io"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"] }
futures = "0.3.21"
-jsonrpsee = { version = "0.14.0", features = ["server", "macros"] }
+jsonrpsee = { version = "0.15.1", features = ["server", "macros"] }
log = "0.4"
parking_lot = "0.12.0"
serde = { version = "1.0.136", features = ["derive"] }
diff --git a/client/beefy/rpc/src/lib.rs b/client/beefy/rpc/src/lib.rs
index 2c3ffda056c26..3be182ceb8f39 100644
--- a/client/beefy/rpc/src/lib.rs
+++ b/client/beefy/rpc/src/lib.rs
@@ -30,12 +30,12 @@ use futures::{task::SpawnError, FutureExt, StreamExt};
use jsonrpsee::{
core::{async_trait, Error as JsonRpseeError, RpcResult},
proc_macros::rpc,
- types::{error::CallError, ErrorObject},
- PendingSubscription,
+ types::{error::CallError, ErrorObject, SubscriptionResult},
+ SubscriptionSink,
};
use log::warn;
-use beefy_gadget::notification::{BeefyBestBlockStream, BeefySignedCommitmentStream};
+use beefy_gadget::notification::{BeefyBestBlockStream, BeefyVersionedFinalityProofStream};
mod notification;
@@ -101,7 +101,7 @@ pub trait BeefyApi {
/// Implements the BeefyApi RPC trait for interacting with BEEFY.
pub struct Beefy {
- signed_commitment_stream: BeefySignedCommitmentStream,
+ finality_proof_stream: BeefyVersionedFinalityProofStream,
beefy_best_block: Arc>>,
executor: SubscriptionTaskExecutor,
}
@@ -112,7 +112,7 @@ where
{
/// Creates a new Beefy Rpc handler instance.
pub fn new(
- signed_commitment_stream: BeefySignedCommitmentStream,
+ finality_proof_stream: BeefyVersionedFinalityProofStream,
best_block_stream: BeefyBestBlockStream,
executor: SubscriptionTaskExecutor,
) -> Result {
@@ -126,28 +126,28 @@ where
});
executor.spawn("substrate-rpc-subscription", Some("rpc"), future.map(drop).boxed());
- Ok(Self { signed_commitment_stream, beefy_best_block, executor })
+ Ok(Self { finality_proof_stream, beefy_best_block, executor })
}
}
#[async_trait]
-impl BeefyApiServer for Beefy
+impl BeefyApiServer
+ for Beefy
where
Block: BlockT,
{
- fn subscribe_justifications(&self, pending: PendingSubscription) {
+ fn subscribe_justifications(&self, mut sink: SubscriptionSink) -> SubscriptionResult {
let stream = self
- .signed_commitment_stream
+ .finality_proof_stream
.subscribe()
- .map(|sc| notification::EncodedSignedCommitment::new::(sc));
+ .map(|vfp| notification::EncodedVersionedFinalityProof::new::(vfp));
let fut = async move {
- if let Some(mut sink) = pending.accept() {
- sink.pipe_from_stream(stream).await;
- }
+ sink.pipe_from_stream(stream).await;
};
self.executor.spawn("substrate-rpc-subscription", Some("rpc"), fut.boxed());
+ Ok(())
}
async fn latest_finalized(&self) -> RpcResult {
@@ -164,31 +164,32 @@ where
mod tests {
use super::*;
- use beefy_gadget::notification::{
- BeefyBestBlockStream, BeefySignedCommitment, BeefySignedCommitmentSender,
+ use beefy_gadget::{
+ justification::BeefyVersionedFinalityProof,
+ notification::{BeefyBestBlockStream, BeefyVersionedFinalityProofSender},
};
- use beefy_primitives::{known_payload_ids, Payload};
+ use beefy_primitives::{known_payload_ids, Payload, SignedCommitment};
use codec::{Decode, Encode};
use jsonrpsee::{types::EmptyParams, RpcModule};
use sp_runtime::traits::{BlakeTwo256, Hash};
use substrate_test_runtime_client::runtime::Block;
- fn setup_io_handler() -> (RpcModule>, BeefySignedCommitmentSender) {
+ fn setup_io_handler() -> (RpcModule>, BeefyVersionedFinalityProofSender) {
let (_, stream) = BeefyBestBlockStream::::channel();
setup_io_handler_with_best_block_stream(stream)
}
fn setup_io_handler_with_best_block_stream(
best_block_stream: BeefyBestBlockStream,
- ) -> (RpcModule>, BeefySignedCommitmentSender) {
- let (commitment_sender, commitment_stream) =
- BeefySignedCommitmentStream::::channel();
+ ) -> (RpcModule>, BeefyVersionedFinalityProofSender) {
+ let (finality_proof_sender, finality_proof_stream) =
+ BeefyVersionedFinalityProofStream::::channel();
let handler =
- Beefy::new(commitment_stream, best_block_stream, sc_rpc::testing::test_executor())
+ Beefy::new(finality_proof_stream, best_block_stream, sc_rpc::testing::test_executor())
.expect("Setting up the BEEFY RPC handler works");
- (handler.into_rpc(), commitment_sender)
+ (handler.into_rpc(), finality_proof_sender)
}
#[tokio::test]
@@ -196,9 +197,9 @@ mod tests {
let (rpc, _) = setup_io_handler();
let request = r#"{"jsonrpc":"2.0","method":"beefy_getFinalizedHead","params":[],"id":1}"#;
let expected_response = r#"{"jsonrpc":"2.0","error":{"code":1,"message":"BEEFY RPC endpoint not ready"},"id":1}"#.to_string();
- let (result, _) = rpc.raw_json_request(&request).await.unwrap();
+ let (response, _) = rpc.raw_json_request(&request).await.unwrap();
- assert_eq!(expected_response, result,);
+ assert_eq!(expected_response, response.result);
}
#[tokio::test]
@@ -228,8 +229,8 @@ mod tests {
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(2);
while std::time::Instant::now() < deadline {
let (response, _) = io.raw_json_request(request).await.expect("RPC requests work");
- if response != not_ready {
- assert_eq!(response, expected);
+ if response.result != not_ready {
+ assert_eq!(response.result, expected);
// Success
return
}
@@ -259,24 +260,24 @@ mod tests {
.unwrap();
let expected = r#"{"jsonrpc":"2.0","result":false,"id":1}"#;
- assert_eq!(response, expected);
+ assert_eq!(response.result, expected);
}
- fn create_commitment() -> BeefySignedCommitment {
+ fn create_finality_proof() -> BeefyVersionedFinalityProof {
let payload = Payload::new(known_payload_ids::MMR_ROOT_ID, "Hello World!".encode());
- BeefySignedCommitment:: {
+ BeefyVersionedFinalityProof::::V1(SignedCommitment {
commitment: beefy_primitives::Commitment {
payload,
block_number: 5,
validator_set_id: 0,
},
signatures: vec![],
- }
+ })
}
#[tokio::test]
async fn subscribe_and_listen_to_one_justification() {
- let (rpc, commitment_sender) = setup_io_handler();
+ let (rpc, finality_proof_sender) = setup_io_handler();
// Subscribe
let mut sub = rpc
@@ -284,16 +285,16 @@ mod tests {
.await
.unwrap();
- // Notify with commitment
- let commitment = create_commitment();
- let r: Result<(), ()> = commitment_sender.notify(|| Ok(commitment.clone()));
+ // Notify with finality_proof
+ let finality_proof = create_finality_proof();
+ let r: Result<(), ()> = finality_proof_sender.notify(|| Ok(finality_proof.clone()));
r.unwrap();
// Inspect what we received
let (bytes, recv_sub_id) = sub.next::().await.unwrap().unwrap();
- let recv_commitment: BeefySignedCommitment =
+ let recv_finality_proof: BeefyVersionedFinalityProof =
Decode::decode(&mut &bytes[..]).unwrap();
assert_eq!(&recv_sub_id, sub.subscription_id());
- assert_eq!(recv_commitment, commitment);
+ assert_eq!(recv_finality_proof, finality_proof);
}
}
diff --git a/client/beefy/rpc/src/notification.rs b/client/beefy/rpc/src/notification.rs
index 2f58c7c6bb5dc..a815425644d52 100644
--- a/client/beefy/rpc/src/notification.rs
+++ b/client/beefy/rpc/src/notification.rs
@@ -21,19 +21,19 @@ use serde::{Deserialize, Serialize};
use sp_runtime::traits::Block as BlockT;
-/// An encoded signed commitment proving that the given header has been finalized.
+/// An encoded finality proof proving that the given header has been finalized.
/// The given bytes should be the SCALE-encoded representation of a
-/// `beefy_primitives::SignedCommitment`.
+/// `beefy_primitives::VersionedFinalityProof`.
#[derive(Clone, Serialize, Deserialize)]
-pub struct EncodedSignedCommitment(sp_core::Bytes);
+pub struct EncodedVersionedFinalityProof(sp_core::Bytes);
-impl EncodedSignedCommitment {
+impl EncodedVersionedFinalityProof {
pub fn new(
- signed_commitment: beefy_gadget::notification::BeefySignedCommitment,
+ finality_proof: beefy_gadget::justification::BeefyVersionedFinalityProof,
) -> Self
where
Block: BlockT,
{
- EncodedSignedCommitment(signed_commitment.encode().into())
+ EncodedVersionedFinalityProof(finality_proof.encode().into())
}
}
diff --git a/client/beefy/src/error.rs b/client/beefy/src/error.rs
index eacadeb7613a5..dd5fd649d52ce 100644
--- a/client/beefy/src/error.rs
+++ b/client/beefy/src/error.rs
@@ -24,8 +24,12 @@ use std::fmt::Debug;
#[derive(Debug, thiserror::Error, PartialEq)]
pub enum Error {
+ #[error("Backend: {0}")]
+ Backend(String),
#[error("Keystore error: {0}")]
Keystore(String),
#[error("Signature error: {0}")]
Signature(String),
+ #[error("Session uninitialized")]
+ UninitSession,
}
diff --git a/client/beefy/src/import.rs b/client/beefy/src/import.rs
new file mode 100644
index 0000000000000..129484199de89
--- /dev/null
+++ b/client/beefy/src/import.rs
@@ -0,0 +1,201 @@
+// This file is part of Substrate.
+
+// Copyright (C) 2021-2022 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.
+
+// 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
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+use beefy_primitives::{BeefyApi, BEEFY_ENGINE_ID};
+use codec::Encode;
+use log::error;
+use std::{collections::HashMap, sync::Arc};
+
+use sp_api::{ProvideRuntimeApi, TransactionFor};
+use sp_blockchain::{well_known_cache_keys, HeaderBackend};
+use sp_consensus::Error as ConsensusError;
+use sp_runtime::{
+ generic::BlockId,
+ traits::{Block as BlockT, Header as HeaderT, NumberFor},
+ EncodedJustification,
+};
+
+use sc_client_api::backend::Backend;
+use sc_consensus::{BlockCheckParams, BlockImport, BlockImportParams, ImportResult};
+
+use crate::{
+ justification::{decode_and_verify_finality_proof, BeefyVersionedFinalityProof},
+ notification::BeefyVersionedFinalityProofSender,
+};
+
+/// A block-import handler for BEEFY.
+///
+/// This scans each imported block for BEEFY justifications and verifies them.
+/// Wraps a `inner: BlockImport` and ultimately defers to it.
+///
+/// When using BEEFY, the block import worker should be using this block import object.
+pub struct BeefyBlockImport {
+ backend: Arc,
+ runtime: Arc,
+ inner: I,
+ justification_sender: BeefyVersionedFinalityProofSender,
+}
+
+impl Clone for BeefyBlockImport {
+ fn clone(&self) -> Self {
+ BeefyBlockImport {
+ backend: self.backend.clone(),
+ runtime: self.runtime.clone(),
+ inner: self.inner.clone(),
+ justification_sender: self.justification_sender.clone(),
+ }
+ }
+}
+
+impl BeefyBlockImport {
+ /// Create a new BeefyBlockImport.
+ pub fn new(
+ backend: Arc,
+ runtime: Arc,
+ inner: I,
+ justification_sender: BeefyVersionedFinalityProofSender,
+ ) -> BeefyBlockImport {
+ BeefyBlockImport { backend, runtime, inner, justification_sender }
+ }
+}
+
+impl BeefyBlockImport
+where
+ Block: BlockT,
+ BE: Backend,
+ Runtime: ProvideRuntimeApi,
+ Runtime::Api: BeefyApi + Send + Sync,
+{
+ fn decode_and_verify(
+ &self,
+ encoded: &EncodedJustification,
+ number: NumberFor,
+ hash: ::Hash,
+ ) -> Result, ConsensusError> {
+ let block_id = BlockId::hash(hash);
+ let validator_set = self
+ .runtime
+ .runtime_api()
+ .validator_set(&block_id)
+ .map_err(|e| ConsensusError::ClientImport(e.to_string()))?
+ .ok_or_else(|| ConsensusError::ClientImport("Unknown validator set".to_string()))?;
+
+ decode_and_verify_finality_proof::(&encoded[..], number, &validator_set)
+ }
+
+ /// Import BEEFY justification: Send it to worker for processing and also append it to backend.
+ ///
+ /// This function assumes:
+ /// - `justification` is verified and valid,
+ /// - the block referred by `justification` has been imported _and_ finalized.
+ fn import_beefy_justification_unchecked(
+ &self,
+ number: NumberFor,
+ justification: BeefyVersionedFinalityProof,
+ ) {
+ // Append the justification to the block in the backend.
+ if let Err(e) = self.backend.append_justification(
+ BlockId::Number(number),
+ (BEEFY_ENGINE_ID, justification.encode()),
+ ) {
+ error!(target: "beefy", "🥩 Error {:?} on appending justification: {:?}", e, justification);
+ }
+ // Send the justification to the BEEFY voter for processing.
+ self.justification_sender
+ .notify(|| Ok::<_, ()>(justification))
+ .expect("forwards closure result; the closure always returns Ok; qed.");
+ }
+}
+
+#[async_trait::async_trait]
+impl BlockImport for BeefyBlockImport
+where
+ Block: BlockT,
+ BE: Backend,
+ I: BlockImport<
+ Block,
+ Error = ConsensusError,
+ Transaction = sp_api::TransactionFor,
+ > + Send
+ + Sync,
+ Runtime: ProvideRuntimeApi + Send + Sync,
+ Runtime::Api: BeefyApi,
+{
+ type Error = ConsensusError;
+ type Transaction = TransactionFor;
+
+ async fn import_block(
+ &mut self,
+ mut block: BlockImportParams,
+ new_cache: HashMap>,
+ ) -> Result {
+ let hash = block.post_hash();
+ let number = *block.header.number();
+
+ let beefy_proof = block
+ .justifications
+ .as_mut()
+ .and_then(|just| {
+ let decoded = just
+ .get(BEEFY_ENGINE_ID)
+ .map(|encoded| self.decode_and_verify(encoded, number, hash));
+ // Remove BEEFY justification from the list before giving to `inner`;
+ // we will append it to backend ourselves at the end if all goes well.
+ just.remove(BEEFY_ENGINE_ID);
+ decoded
+ })
+ .transpose()
+ .unwrap_or(None);
+
+ // Run inner block import.
+ let inner_import_result = self.inner.import_block(block, new_cache).await?;
+
+ match (beefy_proof, &inner_import_result) {
+ (Some(proof), ImportResult::Imported(_)) => {
+ let status = self.backend.blockchain().info();
+ if number <= status.finalized_number &&
+ Some(hash) ==
+ self.backend
+ .blockchain()
+ .hash(number)
+ .map_err(|e| ConsensusError::ClientImport(e.to_string()))?
+ {
+ // The proof is valid and the block is imported and final, we can import.
+ self.import_beefy_justification_unchecked(number, proof);
+ } else {
+ error!(
+ target: "beefy",
+ "🥩 Cannot import justification: {:?} for, not yet final, block number {:?}",
+ proof,
+ number,
+ );
+ }
+ },
+ _ => (),
+ }
+
+ Ok(inner_import_result)
+ }
+
+ async fn check_block(
+ &mut self,
+ block: BlockCheckParams,
+ ) -> Result {
+ self.inner.check_block(block).await
+ }
+}
diff --git a/client/beefy/src/justification.rs b/client/beefy/src/justification.rs
new file mode 100644
index 0000000000000..d9be18593dac7
--- /dev/null
+++ b/client/beefy/src/justification.rs
@@ -0,0 +1,188 @@
+// This file is part of Substrate.
+
+// Copyright (C) 2021-2022 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.
+
+// 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
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+use crate::keystore::BeefyKeystore;
+use beefy_primitives::{
+ crypto::{AuthorityId, Signature},
+ ValidatorSet, VersionedFinalityProof,
+};
+use codec::{Decode, Encode};
+use sp_consensus::Error as ConsensusError;
+use sp_runtime::traits::{Block as BlockT, NumberFor};
+
+/// A finality proof with matching BEEFY authorities' signatures.
+pub type BeefyVersionedFinalityProof =
+ beefy_primitives::VersionedFinalityProof, Signature>;
+
+/// Decode and verify a Beefy FinalityProof.
+pub(crate) fn decode_and_verify_finality_proof(
+ encoded: &[u8],
+ target_number: NumberFor,
+ validator_set: &ValidatorSet,
+) -> Result, ConsensusError> {
+ let proof = >::decode(&mut &*encoded)
+ .map_err(|_| ConsensusError::InvalidJustification)?;
+ verify_with_validator_set::(target_number, validator_set, &proof).map(|_| proof)
+}
+
+/// Verify the Beefy finality proof against the validator set at the block it was generated.
+fn verify_with_validator_set(
+ target_number: NumberFor,
+ validator_set: &ValidatorSet,
+ proof: &BeefyVersionedFinalityProof,
+) -> Result<(), ConsensusError> {
+ match proof {
+ VersionedFinalityProof::V1(signed_commitment) => {
+ if signed_commitment.signatures.len() != validator_set.len() ||
+ signed_commitment.commitment.validator_set_id != validator_set.id() ||
+ signed_commitment.commitment.block_number != target_number
+ {
+ return Err(ConsensusError::InvalidJustification)
+ }
+
+ // Arrangement of signatures in the commitment should be in the same order
+ // as validators for that set.
+ let message = signed_commitment.commitment.encode();
+ let valid_signatures = validator_set
+ .validators()
+ .into_iter()
+ .zip(signed_commitment.signatures.iter())
+ .filter(|(id, signature)| {
+ signature
+ .as_ref()
+ .map(|sig| BeefyKeystore::verify(id, sig, &message[..]))
+ .unwrap_or(false)
+ })
+ .count();
+ if valid_signatures >= crate::round::threshold(validator_set.len()) {
+ Ok(())
+ } else {
+ Err(ConsensusError::InvalidJustification)
+ }
+ },
+ }
+}
+
+#[cfg(test)]
+pub(crate) mod tests {
+ use beefy_primitives::{
+ known_payload_ids, Commitment, Payload, SignedCommitment, VersionedFinalityProof,
+ };
+ use substrate_test_runtime_client::runtime::Block;
+
+ use super::*;
+ use crate::{keystore::tests::Keyring, tests::make_beefy_ids};
+
+ pub(crate) fn new_finality_proof(
+ block_num: NumberFor,
+ validator_set: &ValidatorSet,
+ keys: &[Keyring],
+ ) -> BeefyVersionedFinalityProof {
+ let commitment = Commitment {
+ payload: Payload::new(known_payload_ids::MMR_ROOT_ID, vec![]),
+ block_number: block_num,
+ validator_set_id: validator_set.id(),
+ };
+ let message = commitment.encode();
+ let signatures = keys.iter().map(|key| Some(key.sign(&message))).collect();
+ VersionedFinalityProof::V1(SignedCommitment { commitment, signatures })
+ }
+
+ #[test]
+ fn should_verify_with_validator_set() {
+ let keys = &[Keyring::Alice, Keyring::Bob, Keyring::Charlie];
+ let validator_set = ValidatorSet::new(make_beefy_ids(keys), 0).unwrap();
+
+ // build valid justification
+ let block_num = 42;
+ let proof = new_finality_proof(block_num, &validator_set, keys);
+
+ let good_proof = proof.clone().into();
+ // should verify successfully
+ verify_with_validator_set::(block_num, &validator_set, &good_proof).unwrap();
+
+ // wrong block number -> should fail verification
+ let good_proof = proof.clone().into();
+ match verify_with_validator_set::(block_num + 1, &validator_set, &good_proof) {
+ Err(ConsensusError::InvalidJustification) => (),
+ _ => assert!(false, "Expected Err(ConsensusError::InvalidJustification)"),
+ };
+
+ // wrong validator set id -> should fail verification
+ let good_proof = proof.clone().into();
+ let other = ValidatorSet::new(make_beefy_ids(keys), 1).unwrap();
+ match verify_with_validator_set::(block_num, &other, &good_proof) {
+ Err(ConsensusError::InvalidJustification) => (),
+ _ => assert!(false, "Expected Err(ConsensusError::InvalidJustification)"),
+ };
+
+ // wrong signatures length -> should fail verification
+ let mut bad_proof = proof.clone();
+ // change length of signatures
+ let bad_signed_commitment = match bad_proof {
+ VersionedFinalityProof::V1(ref mut sc) => sc,
+ };
+ bad_signed_commitment.signatures.pop().flatten().unwrap();
+ match verify_with_validator_set::(block_num + 1, &validator_set, &bad_proof.into()) {
+ Err(ConsensusError::InvalidJustification) => (),
+ _ => assert!(false, "Expected Err(ConsensusError::InvalidJustification)"),
+ };
+
+ // not enough signatures -> should fail verification
+ let mut bad_proof = proof.clone();
+ let bad_signed_commitment = match bad_proof {
+ VersionedFinalityProof::V1(ref mut sc) => sc,
+ };
+ // remove a signature (but same length)
+ *bad_signed_commitment.signatures.first_mut().unwrap() = None;
+ match verify_with_validator_set::(block_num + 1, &validator_set, &bad_proof.into()) {
+ Err(ConsensusError::InvalidJustification) => (),
+ _ => assert!(false, "Expected Err(ConsensusError::InvalidJustification)"),
+ };
+
+ // not enough _correct_ signatures -> should fail verification
+ let mut bad_proof = proof.clone();
+ let bad_signed_commitment = match bad_proof {
+ VersionedFinalityProof::V1(ref mut sc) => sc,
+ };
+ // change a signature to a different key
+ *bad_signed_commitment.signatures.first_mut().unwrap() =
+ Some(Keyring::Dave.sign(&bad_signed_commitment.commitment.encode()));
+ match verify_with_validator_set::(block_num + 1, &validator_set, &bad_proof.into()) {
+ Err(ConsensusError::InvalidJustification) => (),
+ _ => assert!(false, "Expected Err(ConsensusError::InvalidJustification)"),
+ };
+ }
+
+ #[test]
+ fn should_decode_and_verify_finality_proof() {
+ let keys = &[Keyring::Alice, Keyring::Bob];
+ let validator_set = ValidatorSet::new(make_beefy_ids(keys), 0).unwrap();
+ let block_num = 1;
+
+ // build valid justification
+ let proof = new_finality_proof(block_num, &validator_set, keys);
+ let versioned_proof: BeefyVersionedFinalityProof = proof.into();
+ let encoded = versioned_proof.encode();
+
+ // should successfully decode and verify
+ let verified =
+ decode_and_verify_finality_proof::(&encoded, block_num, &validator_set).unwrap();
+ assert_eq!(verified, versioned_proof);
+ }
+}
diff --git a/client/beefy/src/lib.rs b/client/beefy/src/lib.rs
index c025ec5686ad2..bdf44e056786c 100644
--- a/client/beefy/src/lib.rs
+++ b/client/beefy/src/lib.rs
@@ -16,23 +16,18 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use std::sync::Arc;
-
+use beefy_primitives::{BeefyApi, MmrRootHash};
use prometheus::Registry;
-
use sc_client_api::{Backend, BlockchainEvents, Finalizer};
+use sc_consensus::BlockImport;
use sc_network_gossip::Network as GossipNetwork;
-
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
-use sp_consensus::SyncOracle;
+use sp_consensus::{Error as ConsensusError, SyncOracle};
use sp_keystore::SyncCryptoStorePtr;
use sp_mmr_primitives::MmrApi;
use sp_runtime::traits::Block;
-
-use beefy_primitives::{BeefyApi, MmrRootHash};
-
-use crate::notification::{BeefyBestBlockSender, BeefySignedCommitmentSender};
+use std::sync::Arc;
mod error;
mod gossip;
@@ -41,11 +36,21 @@ mod metrics;
mod round;
mod worker;
+pub mod import;
+pub mod justification;
pub mod notification;
#[cfg(test)]
mod tests;
+use crate::{
+ import::BeefyBlockImport,
+ notification::{
+ BeefyBestBlockSender, BeefyBestBlockStream, BeefyVersionedFinalityProofSender,
+ BeefyVersionedFinalityProofStream,
+ },
+};
+
pub use beefy_protocol_name::standard_name as protocol_standard_name;
pub(crate) mod beefy_protocol_name {
@@ -110,6 +115,68 @@ where
// empty
}
+/// Links between the block importer, the background voter and the RPC layer,
+/// to be used by the voter.
+#[derive(Clone)]
+pub struct BeefyVoterLinks {
+ // BlockImport -> Voter links
+ /// Stream of BEEFY signed commitments from block import to voter.
+ pub from_block_import_justif_stream: BeefyVersionedFinalityProofStream,
+
+ // Voter -> RPC links
+ /// Sends BEEFY signed commitments from voter to RPC.
+ pub to_rpc_justif_sender: BeefyVersionedFinalityProofSender,
+ /// Sends BEEFY best block hashes from voter to RPC.
+ pub to_rpc_best_block_sender: BeefyBestBlockSender,
+}
+
+/// Links used by the BEEFY RPC layer, from the BEEFY background voter.
+#[derive(Clone)]
+pub struct BeefyRPCLinks {
+ /// Stream of signed commitments coming from the voter.
+ pub from_voter_justif_stream: BeefyVersionedFinalityProofStream,
+ /// Stream of BEEFY best block hashes coming from the voter.
+ pub from_voter_best_beefy_stream: BeefyBestBlockStream,
+}
+
+/// Make block importer and link half necessary to tie the background voter to it.
+pub fn beefy_block_import_and_links(
+ wrapped_block_import: I,
+ backend: Arc,
+ runtime: Arc