mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
---
|
||||
name: New blank issue
|
||||
about: New blank issue
|
||||
---
|
||||
@@ -2,7 +2,7 @@ version: 2
|
||||
updates:
|
||||
- package-ecosystem: "cargo"
|
||||
directory: "/"
|
||||
labels: ["A2-insubstantial", "B0-silent", "C1-low 📌"]
|
||||
labels: ["A2-insubstantial", "B0-silent", "C1-low"]
|
||||
# Handle updates for crates from github.com/paritytech/substrate manually.
|
||||
ignore:
|
||||
- dependency-name: "substrate-*"
|
||||
@@ -25,6 +25,6 @@ updates:
|
||||
interval: "daily"
|
||||
- package-ecosystem: github-actions
|
||||
directory: '/'
|
||||
labels: ["A2-insubstantial", "B0-silent", "C1-low 📌", "E3-dependencies"]
|
||||
labels: ["A2-insubstantial", "B0-silent", "C1-low", "E2-dependencies"]
|
||||
schedule:
|
||||
interval: daily
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
run: rustup show
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v1
|
||||
uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0
|
||||
|
||||
- name: Build rustdocs
|
||||
run: SKIP_WASM_BUILD=1 cargo doc --all --no-deps
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
run: echo "<meta http-equiv=refresh content=0;url=cumulus_client_collator/index.html>" > ./target/doc/index.html
|
||||
|
||||
- name: Deploy documentation
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 # v3.8.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_branch: gh-pages
|
||||
|
||||
@@ -192,7 +192,7 @@ jobs:
|
||||
|
||||
- name: Create draft release
|
||||
id: create-release
|
||||
uses: actions/create-release@v1
|
||||
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
@@ -258,7 +258,7 @@ jobs:
|
||||
mv "$(sed -E 's/-(.*)/_\1/' <<< ${{ matrix.runtime }})_runtime.compact.compressed.wasm" "${{ matrix.runtime }}_runtime.compact.compressed.wasm" || true
|
||||
|
||||
- name: Upload compressed ${{ matrix.runtime }} wasm
|
||||
uses: actions/upload-release-asset@v1
|
||||
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
|
||||
+188
-5
@@ -11,6 +11,7 @@ stages:
|
||||
- benchmarks-build
|
||||
- benchmarks-run
|
||||
- publish
|
||||
- integration-test
|
||||
|
||||
default:
|
||||
interruptible: true
|
||||
@@ -28,6 +29,7 @@ variables:
|
||||
CI_IMAGE: "paritytech/ci-linux:production"
|
||||
DOCKER_OS: "debian:stretch"
|
||||
ARCH: "x86_64"
|
||||
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.2.56"
|
||||
|
||||
.collect-artifacts: &collect-artifacts
|
||||
artifacts:
|
||||
@@ -84,6 +86,15 @@ variables:
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000
|
||||
|
||||
.zombienet-refs: &zombienet-refs
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "pipeline"
|
||||
when: never
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule"
|
||||
when: never
|
||||
- if: $CI_COMMIT_REF_NAME == "master"
|
||||
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
|
||||
|
||||
.docker-env: &docker-env
|
||||
image: "${CI_IMAGE}"
|
||||
before_script:
|
||||
@@ -212,6 +223,8 @@ build-test-parachain:
|
||||
- echo "___Packing the artifacts___"
|
||||
- mkdir -p ./artifacts
|
||||
- mv ./target/release/test-parachain ./artifacts/.
|
||||
- mkdir -p ./artifacts/zombienet
|
||||
- mv ./target/release/wbuild/cumulus-test-runtime/wasm_binary_spec_version_incremented.rs.compact.compressed.wasm ./artifacts/zombienet/.
|
||||
|
||||
#### stage: publish
|
||||
|
||||
@@ -313,7 +326,7 @@ benchmarks-build:
|
||||
- git commit -m "[benchmarks] pr with weights"
|
||||
- git push origin $BRANCHNAME
|
||||
|
||||
benchmarks-statemint:
|
||||
benchmarks-assets:
|
||||
stage: benchmarks-run
|
||||
before_script:
|
||||
- *rust-info-script
|
||||
@@ -326,9 +339,24 @@ benchmarks-statemint:
|
||||
- ./scripts/benchmarks-ci.sh assets westmint ./artifacts
|
||||
- export BRANCHNAME="weights-statemint-${CI_COMMIT_BRANCH}"
|
||||
- *git-commit-push
|
||||
# create PR
|
||||
# create PR to release-parachains-v* branch
|
||||
- curl -u ${GITHUB_USER}:${GITHUB_TOKEN}
|
||||
-d '{"title":"[benchmarks] Update weights for statemine/t","body":"This PR is generated automatically by CI.","head":"'$BRANCHNAME'","base":"'${CI_COMMIT_BRANCH}'"}'
|
||||
-d '{"title":"[benchmarks] Update weights for statemine/t","body":"This PR is generated automatically by CI.","head":"'${BRANCHNAME}'","base":"'${CI_COMMIT_BRANCH}'"}'
|
||||
-X POST https://api.github.com/repos/paritytech/${CI_PROJECT_NAME}/pulls
|
||||
# create PR to master
|
||||
- curl -u ${GITHUB_USER}:${GITHUB_TOKEN}
|
||||
-d '{"title":"[benchmarks] Update weights for statemine/t","body":"This PR is generated automatically by CI.","head":"'${BRANCHNAME}'","base":"master"}'
|
||||
-X POST https://api.github.com/repos/paritytech/${CI_PROJECT_NAME}/pulls
|
||||
# create PR to a branch with version number (e.g. v0.9.270) and release-v* (e.g. release-v0.9.270)
|
||||
# transform release-parachains-v9270 to v0.9.270
|
||||
- export BASEBRANCH=$(echo ${CI_COMMIT_BRANCH} | cut -d "-" -f 3 | sed -e "s/\(.\)\(.\)\(...\)/\10.\2.\3/")
|
||||
# create PR to v* branch
|
||||
- curl -u ${GITHUB_USER}:${GITHUB_TOKEN}
|
||||
-d '{"title":"[benchmarks] Update weights for statemine/t","body":"This PR is generated automatically by CI.","head":"'${BRANCHNAME}'","base":"'${BASEBRANCH}'"}'
|
||||
-X POST https://api.github.com/repos/paritytech/${CI_PROJECT_NAME}/pulls
|
||||
# create PR to release-v* branch
|
||||
- curl -u ${GITHUB_USER}:${GITHUB_TOKEN}
|
||||
-d '{"title":"[benchmarks] Update weights for statemine/t","body":"This PR is generated automatically by CI.","head":"'${BRANCHNAME}'","base":"'release-${BASEBRANCH}'"}'
|
||||
-X POST https://api.github.com/repos/paritytech/${CI_PROJECT_NAME}/pulls
|
||||
after_script:
|
||||
- rm -rf .git/config
|
||||
@@ -355,13 +383,13 @@ benchmarks-collectives:
|
||||
tags:
|
||||
- weights
|
||||
|
||||
publish-benchmarks-statemint-s3: &publish-benchmarks
|
||||
publish-benchmarks-assets-s3: &publish-benchmarks
|
||||
stage: publish
|
||||
<<: *kubernetes-env
|
||||
image: paritytech/awscli:latest
|
||||
<<: *benchmarks-refs
|
||||
needs:
|
||||
- job: benchmarks-statemint
|
||||
- job: benchmarks-assets
|
||||
artifacts: true
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
@@ -395,6 +423,161 @@ update-parachain-template:
|
||||
--github-api-token "$GITHUB_TOKEN"
|
||||
--polkadot-branch "$CI_COMMIT_REF_NAME"
|
||||
|
||||
#### stage: integration-test
|
||||
|
||||
zombienet-0001-sync_blocks_from_tip_without_connected_collator:
|
||||
stage: integration-test
|
||||
image: "${ZOMBIENET_IMAGE}"
|
||||
<<: *zombienet-refs
|
||||
needs:
|
||||
- job: build-push-image-test-parachain
|
||||
variables:
|
||||
POLKADOT_IMAGE: "docker.io/paritypr/polkadot-debug:master"
|
||||
GH_DIR: "https://github.com/paritytech/cumulus/tree/${CI_COMMIT_SHORT_SHA}/zombienet_tests"
|
||||
COL_IMAGE: "docker.io/paritypr/test-parachain:${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
|
||||
before_script:
|
||||
- echo "Zombie-net Tests Config"
|
||||
- echo "${ZOMBIENET_IMAGE}"
|
||||
- echo "${RELAY_IMAGE}"
|
||||
- echo "${COL_IMAGE}"
|
||||
- echo "${GH_DIR}"
|
||||
- export DEBUG=zombie
|
||||
- export RELAY_IMAGE=${POLKADOT_IMAGE}
|
||||
- export COL_IMAGE=${COL_IMAGE}
|
||||
script:
|
||||
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
|
||||
--github-remote-dir="${GH_DIR}"
|
||||
--concurrency=1
|
||||
--test="0001-sync_blocks_from_tip_without_connected_collator.feature"
|
||||
allow_failure: true
|
||||
retry: 2
|
||||
tags:
|
||||
- zombienet-polkadot-integration-test
|
||||
|
||||
zombienet-0002-pov_recovery:
|
||||
stage: integration-test
|
||||
image: "${ZOMBIENET_IMAGE}"
|
||||
<<: *zombienet-refs
|
||||
needs:
|
||||
- job: build-push-image-test-parachain
|
||||
variables:
|
||||
POLKADOT_IMAGE: "docker.io/paritypr/polkadot-debug:master"
|
||||
GH_DIR: "https://github.com/paritytech/cumulus/tree/${CI_COMMIT_SHORT_SHA}/zombienet_tests"
|
||||
COL_IMAGE: "docker.io/paritypr/test-parachain:${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
|
||||
before_script:
|
||||
- echo "Zombie-net Tests Config"
|
||||
- echo "${ZOMBIENET_IMAGE}"
|
||||
- echo "${RELAY_IMAGE}"
|
||||
- echo "${COL_IMAGE}"
|
||||
- echo "${GH_DIR}"
|
||||
- export DEBUG=zombie
|
||||
- export RELAY_IMAGE=${POLKADOT_IMAGE}
|
||||
- export COL_IMAGE=${COL_IMAGE}
|
||||
script:
|
||||
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
|
||||
--github-remote-dir="${GH_DIR}"
|
||||
--concurrency=1
|
||||
--test="0002-pov_recovery.feature"
|
||||
allow_failure: true
|
||||
retry: 2
|
||||
tags:
|
||||
- zombienet-polkadot-integration-test
|
||||
|
||||
zombienet-0003-full_node_catching_up:
|
||||
stage: integration-test
|
||||
image: "${ZOMBIENET_IMAGE}"
|
||||
<<: *zombienet-refs
|
||||
needs:
|
||||
- job: build-push-image-test-parachain
|
||||
variables:
|
||||
POLKADOT_IMAGE: "docker.io/paritypr/polkadot-debug:master"
|
||||
GH_DIR: "https://github.com/paritytech/cumulus/tree/${CI_COMMIT_SHORT_SHA}/zombienet_tests"
|
||||
COL_IMAGE: "docker.io/paritypr/test-parachain:${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
|
||||
before_script:
|
||||
- echo "Zombie-net Tests Config"
|
||||
- echo "${ZOMBIENET_IMAGE}"
|
||||
- echo "${RELAY_IMAGE}"
|
||||
- echo "${COL_IMAGE}"
|
||||
- echo "${GH_DIR}"
|
||||
- export DEBUG=zombie
|
||||
- export RELAY_IMAGE=${POLKADOT_IMAGE}
|
||||
- export COL_IMAGE=${COL_IMAGE}
|
||||
script:
|
||||
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
|
||||
--github-remote-dir="${GH_DIR}"
|
||||
--concurrency=1
|
||||
--test="0003-full_node_catching_up.feature"
|
||||
allow_failure: true
|
||||
retry: 2
|
||||
tags:
|
||||
- zombienet-polkadot-integration-test
|
||||
|
||||
zombienet-0004-runtime_upgrade:
|
||||
stage: integration-test
|
||||
image: "${ZOMBIENET_IMAGE}"
|
||||
<<: *zombienet-refs
|
||||
needs:
|
||||
- job: build-push-image-test-parachain
|
||||
- job: build-test-parachain
|
||||
artifacts: true
|
||||
variables:
|
||||
POLKADOT_IMAGE: "docker.io/paritypr/polkadot-debug:master"
|
||||
GH_DIR: "https://github.com/paritytech/cumulus/tree/${CI_COMMIT_SHORT_SHA}/zombienet_tests"
|
||||
COL_IMAGE: "docker.io/paritypr/test-parachain:${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
|
||||
before_script:
|
||||
- ls -ltr *
|
||||
- cp ./artifacts/zombienet/wasm_binary_spec_version_incremented.rs.compact.compressed.wasm /tmp/
|
||||
- ls /tmp
|
||||
- echo "Zombie-net Tests Config"
|
||||
- echo "${ZOMBIENET_IMAGE}"
|
||||
- echo "${RELAY_IMAGE}"
|
||||
- echo "${COL_IMAGE}"
|
||||
- echo "${GH_DIR}"
|
||||
- export DEBUG=zombie
|
||||
- export RELAY_IMAGE=${POLKADOT_IMAGE}
|
||||
- export COL_IMAGE=${COL_IMAGE}
|
||||
script:
|
||||
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
|
||||
--github-remote-dir="${GH_DIR}"
|
||||
--concurrency=1
|
||||
--test="0004-runtime_upgrade.feature"
|
||||
allow_failure: true
|
||||
retry: 2
|
||||
tags:
|
||||
- zombienet-polkadot-integration-test
|
||||
|
||||
zombienet-0005-migrate_solo_to_para:
|
||||
stage: integration-test
|
||||
image: "${ZOMBIENET_IMAGE}"
|
||||
<<: *zombienet-refs
|
||||
needs:
|
||||
- job: build-push-image-test-parachain
|
||||
- job: build-test-parachain
|
||||
artifacts: true
|
||||
variables:
|
||||
POLKADOT_IMAGE: "docker.io/paritypr/polkadot-debug:master"
|
||||
GH_DIR: "https://github.com/paritytech/cumulus/tree/${CI_COMMIT_SHORT_SHA}/zombienet_tests"
|
||||
COL_IMAGE: "docker.io/paritypr/test-parachain:${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
|
||||
before_script:
|
||||
- ls -ltr *
|
||||
- echo "Zombie-net Tests Config"
|
||||
- echo "${ZOMBIENET_IMAGE}"
|
||||
- echo "${RELAY_IMAGE}"
|
||||
- echo "${COL_IMAGE}"
|
||||
- echo "${GH_DIR}"
|
||||
- export DEBUG=zombie
|
||||
- export RELAY_IMAGE=${POLKADOT_IMAGE}
|
||||
- export COL_IMAGE=${COL_IMAGE}
|
||||
script:
|
||||
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
|
||||
--github-remote-dir="${GH_DIR}"
|
||||
--concurrency=1
|
||||
--test="0005-migrate_solo_to_para.feature"
|
||||
allow_failure: true
|
||||
retry: 2
|
||||
tags:
|
||||
- zombienet-polkadot-integration-test
|
||||
|
||||
#### stage: .post
|
||||
|
||||
# This job cancels the whole pipeline if any of provided jobs fail.
|
||||
|
||||
Generated
+395
-338
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "3.2.16", features = ["derive", "deprecated"] }
|
||||
clap = { version = "3.2.17", features = ["derive", "deprecated"] }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||
url = "2.2.2"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
async-trait = "0.1.57"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] }
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.23"
|
||||
tracing = "0.1.36"
|
||||
|
||||
# Substrate
|
||||
|
||||
@@ -9,7 +9,7 @@ edition = "2021"
|
||||
async-trait = "0.1.57"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] }
|
||||
dyn-clone = "1.0.9"
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.23"
|
||||
tracing = "0.1.36"
|
||||
|
||||
# Substrate
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
async-trait = "0.1.57"
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.23"
|
||||
parking_lot = "0.12.1"
|
||||
tracing = "0.1.36"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ edition = "2021"
|
||||
async-trait = "0.1.57"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] }
|
||||
derive_more = "0.99.2"
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.23"
|
||||
futures-timer = "3.0.2"
|
||||
parking_lot = "0.12.1"
|
||||
tracing = "0.1.36"
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] }
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.23"
|
||||
futures-timer = "3.0.2"
|
||||
rand = "0.8.5"
|
||||
tracing = "0.1.36"
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
async-trait = "0.1.57"
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.23"
|
||||
futures-timer = "3.0.2"
|
||||
tracing = "0.1.36"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "mas
|
||||
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.23"
|
||||
parking_lot = "0.12.1"
|
||||
derive_more = "0.99.2"
|
||||
async-trait = "0.1.57"
|
||||
|
||||
@@ -20,7 +20,7 @@ sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master
|
||||
sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
tokio = { version = "1.19.2", features = ["sync"] }
|
||||
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.23"
|
||||
futures-timer = "3.0.2"
|
||||
parity-scale-codec = "3.1.5"
|
||||
parking_lot = "0.12.1"
|
||||
|
||||
@@ -8,7 +8,7 @@ description = "AURA consensus extension pallet for parachains"
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
|
||||
# Substrate
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
@@ -17,7 +17,7 @@ log = { version = "0.4.17", default-features = false }
|
||||
codec = { default-features = false, features = ["derive"], package = "parity-scale-codec", version = "3.0.0" }
|
||||
rand = { version = "0.8.5", features = ["std_rng"], default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", default-features = false }
|
||||
serde = { version = "1.0.144", default-features = false }
|
||||
|
||||
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -12,7 +12,7 @@ environmental = { version = "1.1.2", default-features = false }
|
||||
impl-trait-for-tuples = "0.2.1"
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
|
||||
# Substrate
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
@@ -20,7 +20,7 @@ use cumulus_primitives_core::{
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::traits::HashFor;
|
||||
use sp_state_machine::{Backend, TrieBackend};
|
||||
use sp_state_machine::{Backend, TrieBackend, TrieBackendBuilder};
|
||||
use sp_std::vec::Vec;
|
||||
use sp_trie::{HashDBT, MemoryDB, StorageProof, EMPTY_PREFIX};
|
||||
|
||||
@@ -156,7 +156,7 @@ impl RelayChainStateProof {
|
||||
if !db.contains(&relay_parent_storage_root, EMPTY_PREFIX) {
|
||||
return Err(Error::RootMismatch)
|
||||
}
|
||||
let trie_backend = TrieBackend::new(db, relay_parent_storage_root);
|
||||
let trie_backend = TrieBackendBuilder::new(db, relay_parent_storage_root).build();
|
||||
|
||||
Ok(Self { para_id, trie_backend })
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ where
|
||||
|
||||
sp_std::mem::drop(storage_proof);
|
||||
|
||||
let backend = sp_state_machine::TrieBackend::new(db, *parent_head.state_root());
|
||||
let backend = sp_state_machine::TrieBackendBuilder::new(db, *parent_head.state_root()).build();
|
||||
|
||||
let _guard = (
|
||||
// Replace storage calls with our own implementations
|
||||
|
||||
@@ -7,7 +7,7 @@ version = "0.1.0"
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
@@ -10,11 +10,11 @@ edition = "2021"
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "3.2.16", features = ["derive"] }
|
||||
clap = { version = "3.2.17", features = ["derive"] }
|
||||
derive_more = "0.99.2"
|
||||
log = "0.4.17"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||
serde = { version = "1.0.143", features = ["derive"] }
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
hex-literal = "0.3.4"
|
||||
jsonrpsee = { version = "0.15.1", features = ["server"] }
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ pub type ChainSpec =
|
||||
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
|
||||
|
||||
/// Helper function to generate a crypto pair from seed
|
||||
pub fn get_public_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
||||
.expect("static values are valid; qed")
|
||||
.public()
|
||||
@@ -43,7 +43,7 @@ type AccountPublic = <Signature as Verify>::Signer;
|
||||
///
|
||||
/// This function's return type must always match the session keys of the chain in tuple format.
|
||||
pub fn get_collator_keys_from_seed(seed: &str) -> AuraId {
|
||||
get_public_from_seed::<AuraId>(seed)
|
||||
get_from_seed::<AuraId>(seed)
|
||||
}
|
||||
|
||||
/// Helper function to generate an account ID from seed
|
||||
@@ -51,7 +51,7 @@ pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId
|
||||
where
|
||||
AccountPublic: From<<TPublic::Pair as Pair>::Public>,
|
||||
{
|
||||
AccountPublic::from(get_public_from_seed::<TPublic>(seed)).into_account()
|
||||
AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()
|
||||
}
|
||||
|
||||
/// Generate the session keys from individual elements.
|
||||
|
||||
@@ -399,8 +399,8 @@ impl CliConfiguration<Self> for RelayChainCli {
|
||||
self.base.base.transaction_pool(is_dev)
|
||||
}
|
||||
|
||||
fn state_cache_child_ratio(&self) -> Result<Option<usize>> {
|
||||
self.base.base.state_cache_child_ratio()
|
||||
fn trie_cache_maximum_size(&self) -> Result<Option<usize>> {
|
||||
self.base.base.trie_cache_maximum_size()
|
||||
}
|
||||
|
||||
fn rpc_methods(&self) -> Result<sc_service::config::RpcMethods> {
|
||||
|
||||
@@ -19,7 +19,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
smallvec = "1.9.0"
|
||||
|
||||
# Local
|
||||
|
||||
@@ -614,6 +614,23 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call>
|
||||
for Runtime
|
||||
{
|
||||
fn query_call_info(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
|
||||
TransactionPayment::query_call_info(call, len)
|
||||
}
|
||||
fn query_call_fee_details(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::FeeDetails<Balance> {
|
||||
TransactionPayment::query_call_fee_details(call, len)
|
||||
}
|
||||
}
|
||||
|
||||
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
|
||||
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
|
||||
@@ -7,7 +7,7 @@ version = "0.1.0"
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
@@ -7,7 +7,7 @@ version = "0.1.0"
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
@@ -10,7 +10,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
smallvec = "1.9.0"
|
||||
|
||||
# Substrate
|
||||
|
||||
@@ -743,6 +743,23 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call>
|
||||
for Runtime
|
||||
{
|
||||
fn query_call_info(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
|
||||
TransactionPayment::query_call_info(call, len)
|
||||
}
|
||||
fn query_call_fee_details(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::FeeDetails<Balance> {
|
||||
TransactionPayment::query_call_fee_details(call, len)
|
||||
}
|
||||
}
|
||||
|
||||
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
|
||||
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
|
||||
@@ -214,13 +214,6 @@ impl<T: frame_system::Config> pallet_uniques::WeightInfo for WeightInfo<T> {
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Done by hand to satisfy master branch
|
||||
// This will be regenerated for the next release
|
||||
fn try_increment_id() -> Weight {
|
||||
(20_000_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques ClassMetadataOf (r:1 w:1)
|
||||
fn clear_collection_metadata() -> Weight {
|
||||
|
||||
@@ -9,7 +9,7 @@ description = "Statemint parachain runtime"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
smallvec = "1.9.0"
|
||||
|
||||
|
||||
@@ -772,6 +772,23 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call>
|
||||
for Runtime
|
||||
{
|
||||
fn query_call_info(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
|
||||
TransactionPayment::query_call_info(call, len)
|
||||
}
|
||||
fn query_call_fee_details(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::FeeDetails<Balance> {
|
||||
TransactionPayment::query_call_fee_details(call, len)
|
||||
}
|
||||
}
|
||||
|
||||
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
|
||||
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
|
||||
@@ -214,13 +214,6 @@ impl<T: frame_system::Config> pallet_uniques::WeightInfo for WeightInfo<T> {
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Done by hand to satisfy master branch
|
||||
// This will be regenerated for the next release
|
||||
fn try_increment_id() -> Weight {
|
||||
(20_000_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques ClassMetadataOf (r:1 w:1)
|
||||
fn clear_collection_metadata() -> Weight {
|
||||
|
||||
@@ -10,7 +10,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
smallvec = "1.9.0"
|
||||
|
||||
# Substrate
|
||||
|
||||
@@ -733,6 +733,23 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call>
|
||||
for Runtime
|
||||
{
|
||||
fn query_call_info(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
|
||||
TransactionPayment::query_call_info(call, len)
|
||||
}
|
||||
fn query_call_fee_details(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::FeeDetails<Balance> {
|
||||
TransactionPayment::query_call_fee_details(call, len)
|
||||
}
|
||||
}
|
||||
|
||||
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
|
||||
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
|
||||
@@ -214,13 +214,6 @@ impl<T: frame_system::Config> pallet_uniques::WeightInfo for WeightInfo<T> {
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Done by hand to satisfy master branch
|
||||
// This will be regenerated for the next release
|
||||
fn try_increment_id() -> Weight {
|
||||
(20_000_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques ClassMetadataOf (r:1 w:1)
|
||||
fn clear_collection_metadata() -> Weight {
|
||||
|
||||
@@ -9,7 +9,7 @@ description = "Polkadot Collectives Parachain Runtime"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
smallvec = "1.6.1"
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
smallvec = "1.9.0"
|
||||
|
||||
# Substrate
|
||||
|
||||
@@ -477,6 +477,23 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call>
|
||||
for Runtime
|
||||
{
|
||||
fn query_call_info(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
|
||||
TransactionPayment::query_call_info(call, len)
|
||||
}
|
||||
fn query_call_fee_details(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::FeeDetails<Balance> {
|
||||
TransactionPayment::query_call_fee_details(call, len)
|
||||
}
|
||||
}
|
||||
|
||||
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
|
||||
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2021"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
|
||||
# Substrate
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
@@ -32,6 +32,7 @@ sp-version = { git = "https://github.com/paritytech/substrate", default-features
|
||||
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false }
|
||||
cumulus-pallet-solo-to-para = { path = "../../../../pallets/solo-to-para", default-features = false }
|
||||
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
@@ -64,4 +65,5 @@ std = [
|
||||
"cumulus-pallet-solo-to-para/std",
|
||||
"cumulus-primitives-core/std",
|
||||
"parachain-info/std",
|
||||
"parachains-common/std",
|
||||
]
|
||||
|
||||
@@ -52,6 +52,7 @@ pub use frame_support::{
|
||||
StorageValue,
|
||||
};
|
||||
use frame_system::limits::{BlockLength, BlockWeights};
|
||||
use parachains_common::{AccountId, Signature};
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use sp_runtime::BuildStorage;
|
||||
pub use sp_runtime::{Perbill, Permill};
|
||||
@@ -189,11 +190,6 @@ construct_runtime! {
|
||||
}
|
||||
}
|
||||
|
||||
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
|
||||
pub type Signature = sp_runtime::MultiSignature;
|
||||
/// Some way of identifying an account on the chain. We intentionally make it equivalent
|
||||
/// to the public key of our transaction signing scheme.
|
||||
pub type AccountId = <<Signature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccount>::AccountId;
|
||||
/// Index of a transaction in the chain.
|
||||
pub type Index = u32;
|
||||
/// A hash of some data used by the chain.
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2021"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
|
||||
# Substrate
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
@@ -39,6 +39,7 @@ cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = fals
|
||||
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
|
||||
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
|
||||
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
@@ -73,6 +74,7 @@ std = [
|
||||
"cumulus-primitives-core/std",
|
||||
"cumulus-primitives-utility/std",
|
||||
"parachain-info/std",
|
||||
"parachains-common/std",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-executive/try-runtime",
|
||||
|
||||
@@ -59,6 +59,7 @@ pub use frame_support::{
|
||||
StorageValue,
|
||||
};
|
||||
use frame_system::limits::{BlockLength, BlockWeights};
|
||||
use parachains_common::{AccountId, Signature};
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use sp_runtime::BuildStorage;
|
||||
pub use sp_runtime::{Perbill, Permill};
|
||||
@@ -228,11 +229,6 @@ impl sp_runtime::traits::SignedExtension for DisallowSigned {
|
||||
}
|
||||
}
|
||||
|
||||
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
|
||||
pub type Signature = sp_runtime::MultiSignature;
|
||||
/// Some way of identifying an account on the chain. We intentionally make it equivalent
|
||||
/// to the public key of our transaction signing scheme.
|
||||
pub type AccountId = <<Signature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccount>::AccountId;
|
||||
/// Index of a transaction in the chain.
|
||||
pub type Index = u32;
|
||||
/// A hash of some data used by the chain.
|
||||
|
||||
@@ -19,7 +19,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
log = { version = "0.4.16", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
smallvec = "1.9.0"
|
||||
|
||||
# Substrate
|
||||
@@ -74,6 +74,7 @@ cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", defa
|
||||
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
|
||||
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
|
||||
parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
|
||||
[features]
|
||||
default = [
|
||||
|
||||
@@ -50,9 +50,9 @@ pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic, impl_opaque_keys,
|
||||
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify},
|
||||
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT},
|
||||
transaction_validity::{TransactionSource, TransactionValidity},
|
||||
ApplyExtrinsicResult, MultiSignature,
|
||||
ApplyExtrinsicResult,
|
||||
};
|
||||
pub use sp_runtime::{traits::ConvertInto, MultiAddress, Perbill, Permill};
|
||||
use sp_std::prelude::*;
|
||||
@@ -70,16 +70,10 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
||||
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||
|
||||
// XCM Imports
|
||||
use parachains_common::{AccountId, Signature};
|
||||
use xcm::latest::prelude::BodyId;
|
||||
use xcm_executor::XcmExecutor;
|
||||
|
||||
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
|
||||
pub type Signature = MultiSignature;
|
||||
|
||||
/// Some way of identifying an account on the chain. We intentionally make it equivalent
|
||||
/// to the public key of our transaction signing scheme.
|
||||
pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
|
||||
|
||||
/// Balance of an account.
|
||||
pub type Balance = u128;
|
||||
|
||||
@@ -674,6 +668,23 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call>
|
||||
for Runtime
|
||||
{
|
||||
fn query_call_info(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
|
||||
TransactionPayment::query_call_info(call, len)
|
||||
}
|
||||
fn query_call_fee_details(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::FeeDetails<Balance> {
|
||||
TransactionPayment::query_call_fee_details(call, len)
|
||||
}
|
||||
}
|
||||
|
||||
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
|
||||
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
|
||||
@@ -9,7 +9,7 @@ description = "Simple runtime used by the rococo parachain(s)"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
|
||||
# Substrate
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
@@ -60,7 +60,7 @@ pub use sp_runtime::{Perbill, Permill};
|
||||
|
||||
use parachains_common::{
|
||||
impls::{AssetsFrom, NonZeroIssuance},
|
||||
AssetId,
|
||||
AccountId, AssetId, Signature,
|
||||
};
|
||||
use xcm_builder::{
|
||||
AllowKnownQueryResponses, AllowSubscriptionsFrom, AsPrefixedGeneralIndex, ConvertedConcreteId,
|
||||
@@ -558,11 +558,6 @@ construct_runtime! {
|
||||
}
|
||||
}
|
||||
|
||||
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
|
||||
pub type Signature = sp_runtime::MultiSignature;
|
||||
/// Some way of identifying an account on the chain. We intentionally make it equivalent
|
||||
/// to the public key of our transaction signing scheme.
|
||||
pub type AccountId = <<Signature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccount>::AccountId;
|
||||
/// Balance of an account.
|
||||
pub type Balance = u128;
|
||||
/// Index of a transaction in the chain.
|
||||
@@ -717,6 +712,23 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call>
|
||||
for Runtime
|
||||
{
|
||||
fn query_call_info(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
|
||||
TransactionPayment::query_call_info(call, len)
|
||||
}
|
||||
fn query_call_fee_details(
|
||||
call: Call,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::FeeDetails<Balance> {
|
||||
TransactionPayment::query_call_fee_details(call, len)
|
||||
}
|
||||
}
|
||||
|
||||
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
|
||||
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
|
||||
@@ -8,12 +8,12 @@ description = "Runs a polkadot parachain node which could be a collator."
|
||||
|
||||
[dependencies]
|
||||
async-trait = "0.1.57"
|
||||
clap = { version = "3.2.16", features = ["derive", "deprecated"] }
|
||||
clap = { version = "3.2.17", features = ["derive", "deprecated"] }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.23"
|
||||
hex-literal = "0.3.4"
|
||||
log = "0.4.17"
|
||||
serde = { version = "1.0.143", features = ["derive"] }
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
|
||||
# Local
|
||||
rococo-parachain-runtime = { path = "../parachains/runtimes/testing/rococo-parachain" }
|
||||
@@ -59,6 +59,7 @@ sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "maste
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-serializer = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
@@ -91,10 +92,12 @@ substrate-build-script-utils = { git = "https://github.com/paritytech/substrate"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_cmd = "2.0"
|
||||
nix = "0.24"
|
||||
nix = "0.25"
|
||||
tempfile = "3.3.0"
|
||||
tokio = { version = "1.19.2", features = ["macros", "time", "parking_lot"] }
|
||||
wait-timeout = "0.2"
|
||||
# purge_chain_works works with rococo-local and needs to allow this
|
||||
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master", features = ["rococo-native"] }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
@@ -18,8 +18,7 @@ use crate::chain_spec::{
|
||||
get_account_id_from_seed, get_collator_keys_from_seed, Extensions, SAFE_XCM_VERSION,
|
||||
};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use parachains_common::Balance as CollectivesBalance;
|
||||
use rococo_parachain_runtime::{AccountId, AuraId};
|
||||
use parachains_common::{AccountId, AuraId, Balance as CollectivesBalance};
|
||||
use sc_service::ChainType;
|
||||
use sp_core::sr25519;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ use crate::chain_spec::{
|
||||
};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use hex_literal::hex;
|
||||
use rococo_parachain_runtime::{AccountId, AuraId};
|
||||
use parachains_common::{AccountId, AuraId};
|
||||
use sc_service::ChainType;
|
||||
use sp_core::{crypto::UncheckedInto, sr25519};
|
||||
|
||||
|
||||
@@ -14,37 +14,24 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use hex_literal::hex;
|
||||
use rococo_parachain_runtime::{AccountId, AuraId, Signature};
|
||||
use parachains_common::{AccountId, Signature};
|
||||
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
|
||||
use sc_service::ChainType;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public};
|
||||
use sp_core::{Pair, Public};
|
||||
use sp_runtime::traits::{IdentifyAccount, Verify};
|
||||
|
||||
pub mod collectives;
|
||||
pub mod contracts;
|
||||
pub mod penpal;
|
||||
pub mod rococo_parachain;
|
||||
pub mod seedling;
|
||||
pub mod shell;
|
||||
pub mod statemint;
|
||||
|
||||
/// Specialized `ChainSpec` for the normal parachain runtime.
|
||||
pub type ChainSpec =
|
||||
sc_service::GenericChainSpec<rococo_parachain_runtime::GenesisConfig, Extensions>;
|
||||
|
||||
/// The default XCM version to set in genesis config.
|
||||
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
|
||||
|
||||
/// Helper function to generate a crypto pair from seed
|
||||
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
||||
.expect("static values are valid; qed")
|
||||
.public()
|
||||
}
|
||||
|
||||
/// The extensions for the [`ChainSpec`].
|
||||
/// Generic extensions for Parachain ChainSpecs.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Extensions {
|
||||
@@ -61,6 +48,13 @@ impl Extensions {
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper function to generate a crypto pair from seed
|
||||
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
||||
.expect("static values are valid; qed")
|
||||
.public()
|
||||
}
|
||||
|
||||
type AccountPublic = <Signature as Verify>::Signer;
|
||||
|
||||
/// Helper function to generate an account ID from seed
|
||||
@@ -71,108 +65,9 @@ where
|
||||
AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()
|
||||
}
|
||||
|
||||
pub fn get_chain_spec() -> ChainSpec {
|
||||
ChainSpec::from_genesis(
|
||||
"Local Testnet",
|
||||
"local_testnet",
|
||||
ChainType::Local,
|
||||
move || {
|
||||
testnet_genesis(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
vec![get_from_seed::<AuraId>("Alice"), get_from_seed::<AuraId>("Bob")],
|
||||
vec![
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Charlie"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Eve"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
|
||||
],
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Extensions { relay_chain: "westend".into(), para_id: 1000 },
|
||||
)
|
||||
}
|
||||
|
||||
pub fn staging_test_net() -> ChainSpec {
|
||||
ChainSpec::from_genesis(
|
||||
"Staging Testnet",
|
||||
"staging_testnet",
|
||||
ChainType::Live,
|
||||
move || {
|
||||
testnet_genesis(
|
||||
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into(),
|
||||
vec![
|
||||
// $secret//one
|
||||
hex!["aad9fa2249f87a210a0f93400b7f90e47b810c6d65caa0ca3f5af982904c2a33"]
|
||||
.unchecked_into(),
|
||||
// $secret//two
|
||||
hex!["d47753f0cca9dd8da00c70e82ec4fc5501a69c49a5952a643d18802837c88212"]
|
||||
.unchecked_into(),
|
||||
],
|
||||
vec![
|
||||
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into()
|
||||
],
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Extensions { relay_chain: "westend".into(), para_id: 1000 },
|
||||
)
|
||||
}
|
||||
|
||||
fn testnet_genesis(
|
||||
root_key: AccountId,
|
||||
initial_authorities: Vec<AuraId>,
|
||||
endowed_accounts: Vec<AccountId>,
|
||||
id: ParaId,
|
||||
) -> rococo_parachain_runtime::GenesisConfig {
|
||||
rococo_parachain_runtime::GenesisConfig {
|
||||
system: rococo_parachain_runtime::SystemConfig {
|
||||
code: rococo_parachain_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not build, please build it!")
|
||||
.to_vec(),
|
||||
},
|
||||
balances: rococo_parachain_runtime::BalancesConfig {
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
|
||||
},
|
||||
sudo: rococo_parachain_runtime::SudoConfig { key: Some(root_key) },
|
||||
parachain_info: rococo_parachain_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
aura: rococo_parachain_runtime::AuraConfig { authorities: initial_authorities },
|
||||
aura_ext: Default::default(),
|
||||
parachain_system: Default::default(),
|
||||
polkadot_xcm: rococo_parachain_runtime::PolkadotXcmConfig {
|
||||
safe_xcm_version: Some(SAFE_XCM_VERSION),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper function to generate a crypto pair from seed
|
||||
pub fn get_public_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
||||
.expect("static values are valid; qed")
|
||||
.public()
|
||||
}
|
||||
|
||||
/// Generate collator keys from seed.
|
||||
///
|
||||
/// This function's return type must always match the session keys of the chain in tuple format.
|
||||
pub fn get_collator_keys_from_seed<AuraId: Public>(seed: &str) -> <AuraId::Pair as Pair>::Public {
|
||||
get_public_from_seed::<AuraId>(seed)
|
||||
get_from_seed::<AuraId>(seed)
|
||||
}
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::chain_spec::{get_account_id_from_seed, Extensions};
|
||||
use crate::chain_spec::{
|
||||
get_account_id_from_seed, get_collator_keys_from_seed, Extensions, SAFE_XCM_VERSION,
|
||||
};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
// use rococo_parachain_runtime::{AuraId};
|
||||
use crate::chain_spec::{get_collator_keys_from_seed, SAFE_XCM_VERSION};
|
||||
use parachains_common::{AccountId, AuraId};
|
||||
use sc_service::ChainType;
|
||||
use sp_core::sr25519;
|
||||
/// Specialized `ChainSpec` for the normal parachain runtime.
|
||||
@@ -42,11 +43,11 @@ pub fn get_penpal_chain_spec(id: ParaId, relay_chain: &str) -> PenpalChainSpec {
|
||||
vec![
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_collator_keys_from_seed::<penpal_runtime::AuraId>("Alice"),
|
||||
get_collator_keys_from_seed::<AuraId>("Alice"),
|
||||
),
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_collator_keys_from_seed::<penpal_runtime::AuraId>("Bob"),
|
||||
get_collator_keys_from_seed::<AuraId>("Bob"),
|
||||
),
|
||||
],
|
||||
vec![
|
||||
@@ -79,8 +80,8 @@ pub fn get_penpal_chain_spec(id: ParaId, relay_chain: &str) -> PenpalChainSpec {
|
||||
}
|
||||
|
||||
fn penpal_testnet_genesis(
|
||||
invulnerables: Vec<(penpal_runtime::AccountId, penpal_runtime::AuraId)>,
|
||||
endowed_accounts: Vec<penpal_runtime::AccountId>,
|
||||
invulnerables: Vec<(AccountId, AuraId)>,
|
||||
endowed_accounts: Vec<AccountId>,
|
||||
id: ParaId,
|
||||
) -> penpal_runtime::GenesisConfig {
|
||||
penpal_runtime::GenesisConfig {
|
||||
@@ -131,6 +132,6 @@ fn penpal_testnet_genesis(
|
||||
/// Generate the session keys from individual elements.
|
||||
///
|
||||
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
|
||||
pub fn penpal_session_keys(keys: penpal_runtime::AuraId) -> penpal_runtime::SessionKeys {
|
||||
pub fn penpal_session_keys(keys: AuraId) -> penpal_runtime::SessionKeys {
|
||||
penpal_runtime::SessionKeys { aura: keys }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus 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.
|
||||
|
||||
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! ChainSpecs dedicated to Rococo parachain setups (for testing and example purposes)
|
||||
|
||||
use crate::chain_spec::{get_from_seed, Extensions, SAFE_XCM_VERSION};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use hex_literal::hex;
|
||||
use parachains_common::AccountId;
|
||||
use polkadot_service::chain_spec::get_account_id_from_seed;
|
||||
use rococo_parachain_runtime::AuraId;
|
||||
use sc_chain_spec::ChainType;
|
||||
use sp_core::{crypto::UncheckedInto, sr25519};
|
||||
|
||||
pub type RococoParachainChainSpec =
|
||||
sc_service::GenericChainSpec<rococo_parachain_runtime::GenesisConfig, Extensions>;
|
||||
|
||||
pub fn rococo_parachain_local_config() -> RococoParachainChainSpec {
|
||||
RococoParachainChainSpec::from_genesis(
|
||||
"Rococo Parachain Local",
|
||||
"local_testnet",
|
||||
ChainType::Local,
|
||||
move || {
|
||||
testnet_genesis(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
vec![get_from_seed::<AuraId>("Alice"), get_from_seed::<AuraId>("Bob")],
|
||||
vec![
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Charlie"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Eve"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
|
||||
],
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Extensions { relay_chain: "rococo-local".into(), para_id: 1000 },
|
||||
)
|
||||
}
|
||||
|
||||
pub fn staging_rococo_parachain_local_config() -> RococoParachainChainSpec {
|
||||
RococoParachainChainSpec::from_genesis(
|
||||
"Staging Rococo Parachain Local",
|
||||
"staging_testnet",
|
||||
ChainType::Live,
|
||||
move || {
|
||||
testnet_genesis(
|
||||
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into(),
|
||||
vec![
|
||||
// $secret//one
|
||||
hex!["aad9fa2249f87a210a0f93400b7f90e47b810c6d65caa0ca3f5af982904c2a33"]
|
||||
.unchecked_into(),
|
||||
// $secret//two
|
||||
hex!["d47753f0cca9dd8da00c70e82ec4fc5501a69c49a5952a643d18802837c88212"]
|
||||
.unchecked_into(),
|
||||
],
|
||||
vec![
|
||||
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into()
|
||||
],
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Extensions { relay_chain: "rococo-local".into(), para_id: 1000 },
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn testnet_genesis(
|
||||
root_key: AccountId,
|
||||
initial_authorities: Vec<AuraId>,
|
||||
endowed_accounts: Vec<AccountId>,
|
||||
id: ParaId,
|
||||
) -> rococo_parachain_runtime::GenesisConfig {
|
||||
rococo_parachain_runtime::GenesisConfig {
|
||||
system: rococo_parachain_runtime::SystemConfig {
|
||||
code: rococo_parachain_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not build, please build it!")
|
||||
.to_vec(),
|
||||
},
|
||||
balances: rococo_parachain_runtime::BalancesConfig {
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
|
||||
},
|
||||
sudo: rococo_parachain_runtime::SudoConfig { key: Some(root_key) },
|
||||
parachain_info: rococo_parachain_runtime::ParachainInfoConfig { parachain_id: id },
|
||||
aura: rococo_parachain_runtime::AuraConfig { authorities: initial_authorities },
|
||||
aura_ext: Default::default(),
|
||||
parachain_system: Default::default(),
|
||||
polkadot_xcm: rococo_parachain_runtime::PolkadotXcmConfig {
|
||||
safe_xcm_version: Some(SAFE_XCM_VERSION),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use crate::chain_spec::{get_account_id_from_seed, Extensions};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use rococo_parachain_runtime::AccountId;
|
||||
use parachains_common::AccountId;
|
||||
use sc_service::ChainType;
|
||||
use sp_core::sr25519;
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ use crate::chain_spec::{
|
||||
};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use hex_literal::hex;
|
||||
use parachains_common::{Balance as StatemintBalance, StatemintAuraId};
|
||||
use rococo_parachain_runtime::{AccountId, AuraId};
|
||||
use parachains_common::{AccountId, AuraId, Balance as StatemintBalance, StatemintAuraId};
|
||||
use sc_service::ChainType;
|
||||
use sp_core::{crypto::UncheckedInto, sr25519};
|
||||
|
||||
|
||||
@@ -38,12 +38,15 @@ use sc_service::{
|
||||
};
|
||||
use sp_core::hexdisplay::HexDisplay;
|
||||
use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
|
||||
use std::net::SocketAddr;
|
||||
use std::{net::SocketAddr, path::PathBuf};
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Helper enum that is used for better distinction of different parachain/runtime configuration
|
||||
/// (it is based/calculated on ChainSpec's ID attribute)
|
||||
#[derive(Debug, PartialEq, Default)]
|
||||
enum Runtime {
|
||||
/// This is the default runtime (based on rococo)
|
||||
Generic,
|
||||
/// This is the default runtime (actually based on rococo)
|
||||
#[default]
|
||||
Default,
|
||||
Shell,
|
||||
Seedling,
|
||||
Statemint,
|
||||
@@ -55,22 +58,30 @@ enum Runtime {
|
||||
CollectivesWestend,
|
||||
}
|
||||
|
||||
trait ChainType {
|
||||
trait RuntimeResolver {
|
||||
fn runtime(&self) -> Runtime;
|
||||
}
|
||||
|
||||
impl ChainType for dyn ChainSpec {
|
||||
impl RuntimeResolver for dyn ChainSpec {
|
||||
fn runtime(&self) -> Runtime {
|
||||
runtime(self.id())
|
||||
}
|
||||
}
|
||||
|
||||
use sc_chain_spec::GenericChainSpec;
|
||||
impl ChainType
|
||||
for GenericChainSpec<rococo_parachain_runtime::GenesisConfig, chain_spec::Extensions>
|
||||
{
|
||||
/// Implementation, that can resolve [`Runtime`] from any json configuration file
|
||||
impl RuntimeResolver for PathBuf {
|
||||
fn runtime(&self) -> Runtime {
|
||||
runtime(self.id())
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
struct EmptyChainSpecWithId {
|
||||
id: String,
|
||||
}
|
||||
|
||||
let file = std::fs::File::open(self).expect("Failed to open file");
|
||||
let reader = std::io::BufReader::new(file);
|
||||
let chain_spec: EmptyChainSpecWithId = sp_serializer::from_reader(reader)
|
||||
.expect("Failed to read 'json' file with ChainSpec configuration");
|
||||
|
||||
runtime(&chain_spec.id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,32 +108,41 @@ fn runtime(id: &str) -> Runtime {
|
||||
} else if id.starts_with("collectives-westend") {
|
||||
Runtime::CollectivesWestend
|
||||
} else {
|
||||
Runtime::Generic
|
||||
log::warn!("No specific runtime was recognized for ChainSpec's id: '{}', so Runtime::default() will be used", id);
|
||||
Runtime::default()
|
||||
}
|
||||
}
|
||||
|
||||
fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
let (id, _, para_id) = extract_parachain_id(id);
|
||||
Ok(match id {
|
||||
"staging" => Box::new(chain_spec::staging_test_net()),
|
||||
"tick" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/tick.json")[..],
|
||||
)?),
|
||||
"trick" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/trick.json")[..],
|
||||
)?),
|
||||
"track" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/track.json")[..],
|
||||
)?),
|
||||
// - Defaul-like
|
||||
"staging" =>
|
||||
Box::new(chain_spec::rococo_parachain::staging_rococo_parachain_local_config()),
|
||||
"tick" =>
|
||||
Box::new(chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/tick.json")[..],
|
||||
)?),
|
||||
"trick" =>
|
||||
Box::new(chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/trick.json")[..],
|
||||
)?),
|
||||
"track" =>
|
||||
Box::new(chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/track.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Starters
|
||||
"shell" => Box::new(chain_spec::shell::get_shell_chain_spec()),
|
||||
// -- Statemint
|
||||
"seedling" => Box::new(chain_spec::seedling::get_seedling_chain_spec()),
|
||||
|
||||
// -- Statemint
|
||||
"statemint-dev" => Box::new(chain_spec::statemint::statemint_development_config()),
|
||||
"statemint-local" => Box::new(chain_spec::statemint::statemint_local_config()),
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"statemint-genesis" => Box::new(chain_spec::statemint::statemint_config()),
|
||||
// the shell-based chain spec as used for syncing
|
||||
"statemint" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
"statemint" => Box::new(chain_spec::statemint::StatemintChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/statemint.json")[..],
|
||||
)?),
|
||||
|
||||
@@ -132,7 +152,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"statemine-genesis" => Box::new(chain_spec::statemint::statemine_config()),
|
||||
// the shell-based chain spec as used for syncing
|
||||
"statemine" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
"statemine" => Box::new(chain_spec::statemint::StatemineChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/statemine.json")[..],
|
||||
)?),
|
||||
|
||||
@@ -142,7 +162,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"westmint-genesis" => Box::new(chain_spec::statemint::westmint_config()),
|
||||
// the shell-based chain spec as used for syncing
|
||||
"westmint" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
"westmint" => Box::new(chain_spec::statemint::WestmintChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/westmint.json")[..],
|
||||
)?),
|
||||
|
||||
@@ -151,12 +171,14 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
Box::new(chain_spec::collectives::collectives_polkadot_development_config()),
|
||||
"collectives-polkadot-local" =>
|
||||
Box::new(chain_spec::collectives::collectives_polkadot_local_config()),
|
||||
"collectives-polkadot" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/collectives-polkadot.json")[..],
|
||||
)?),
|
||||
"collectives-westend" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/collectives-westend.json")[..],
|
||||
)?),
|
||||
"collectives-polkadot" =>
|
||||
Box::new(chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/collectives-polkadot.json")[..],
|
||||
)?),
|
||||
"collectives-westend" =>
|
||||
Box::new(chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/collectives-westend.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Contracts on Rococo
|
||||
"contracts-rococo-dev" =>
|
||||
@@ -164,9 +186,12 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
"contracts-rococo-local" =>
|
||||
Box::new(chain_spec::contracts::contracts_rococo_local_config()),
|
||||
"contracts-rococo-genesis" => Box::new(chain_spec::contracts::contracts_rococo_config()),
|
||||
"contracts-rococo" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/contracts-rococo.json")[..],
|
||||
)?),
|
||||
"contracts-rococo" =>
|
||||
Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/contracts-rococo.json")[..],
|
||||
)?),
|
||||
|
||||
// -- Penpall
|
||||
"penpal-kusama" => Box::new(chain_spec::penpal::get_penpal_chain_spec(
|
||||
para_id.expect("Must specify parachain id"),
|
||||
"kusama-local",
|
||||
@@ -177,34 +202,35 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
)),
|
||||
|
||||
// -- Fallback (generic chainspec)
|
||||
"" => Box::new(chain_spec::get_chain_spec()),
|
||||
"" => {
|
||||
log::warn!("No ChainSpec.id specified, so using default one, based on rococo-parachain runtime");
|
||||
Box::new(chain_spec::rococo_parachain::rococo_parachain_local_config())
|
||||
},
|
||||
|
||||
// -- Loading a specific spec from disk
|
||||
path => {
|
||||
let chain_spec = chain_spec::ChainSpec::from_json_file(path.into())?;
|
||||
match chain_spec.runtime() {
|
||||
Runtime::Statemint => Box::new(
|
||||
chain_spec::statemint::StatemintChainSpec::from_json_file(path.into())?,
|
||||
),
|
||||
Runtime::Statemine => Box::new(
|
||||
chain_spec::statemint::StatemineChainSpec::from_json_file(path.into())?,
|
||||
),
|
||||
let path: PathBuf = path.into();
|
||||
match path.runtime() {
|
||||
Runtime::Statemint =>
|
||||
Box::new(chain_spec::statemint::StatemintChainSpec::from_json_file(path)?),
|
||||
Runtime::Statemine =>
|
||||
Box::new(chain_spec::statemint::StatemineChainSpec::from_json_file(path)?),
|
||||
Runtime::Westmint =>
|
||||
Box::new(chain_spec::statemint::WestmintChainSpec::from_json_file(path.into())?),
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend =>
|
||||
Box::new(chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_file(
|
||||
path.into(),
|
||||
)?),
|
||||
Runtime::Shell =>
|
||||
Box::new(chain_spec::shell::ShellChainSpec::from_json_file(path.into())?),
|
||||
Runtime::Seedling =>
|
||||
Box::new(chain_spec::seedling::SeedlingChainSpec::from_json_file(path.into())?),
|
||||
Runtime::ContractsRococo => Box::new(
|
||||
chain_spec::contracts::ContractsRococoChainSpec::from_json_file(path.into())?,
|
||||
Box::new(chain_spec::statemint::WestmintChainSpec::from_json_file(path)?),
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend => Box::new(
|
||||
chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_file(path)?,
|
||||
),
|
||||
Runtime::Shell =>
|
||||
Box::new(chain_spec::shell::ShellChainSpec::from_json_file(path)?),
|
||||
Runtime::Seedling =>
|
||||
Box::new(chain_spec::seedling::SeedlingChainSpec::from_json_file(path)?),
|
||||
Runtime::ContractsRococo =>
|
||||
Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_file(path)?),
|
||||
Runtime::Penpal(_para_id) =>
|
||||
Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path.into())?),
|
||||
Runtime::Generic => Box::new(chain_spec),
|
||||
Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path)?),
|
||||
Runtime::Default => Box::new(
|
||||
chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_file(path)?,
|
||||
),
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -263,7 +289,7 @@ impl SubstrateCli for Cli {
|
||||
2017
|
||||
}
|
||||
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
load_spec(id)
|
||||
}
|
||||
|
||||
@@ -278,7 +304,7 @@ impl SubstrateCli for Cli {
|
||||
Runtime::Seedling => &seedling_runtime::VERSION,
|
||||
Runtime::ContractsRococo => &contracts_rococo_runtime::VERSION,
|
||||
Runtime::Penpal(_) => &penpal_runtime::VERSION,
|
||||
Runtime::Generic => &rococo_parachain_runtime::VERSION,
|
||||
Runtime::Default => &rococo_parachain_runtime::VERSION,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,7 +340,7 @@ impl SubstrateCli for RelayChainCli {
|
||||
2017
|
||||
}
|
||||
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
|
||||
}
|
||||
|
||||
@@ -434,7 +460,7 @@ macro_rules! construct_async_run {
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::Penpal(_) | Runtime::Generic => {
|
||||
Runtime::Penpal(_) | Runtime::Default => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<
|
||||
rococo_parachain_runtime::RuntimeApi,
|
||||
@@ -700,7 +726,7 @@ pub fn run() -> Result<()> {
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::Penpal(_) | Runtime::Generic =>
|
||||
Runtime::Penpal(_) | Runtime::Default =>
|
||||
crate::service::start_rococo_parachain_node(
|
||||
config,
|
||||
polkadot_config,
|
||||
@@ -806,8 +832,8 @@ impl CliConfiguration<Self> for RelayChainCli {
|
||||
self.base.base.transaction_pool(is_dev)
|
||||
}
|
||||
|
||||
fn state_cache_child_ratio(&self) -> Result<Option<usize>> {
|
||||
self.base.base.state_cache_child_ratio()
|
||||
fn trie_cache_maximum_size(&self) -> Result<Option<usize>> {
|
||||
self.base.base.trie_cache_maximum_size()
|
||||
}
|
||||
|
||||
fn rpc_methods(&self) -> Result<sc_service::config::RpcMethods> {
|
||||
@@ -853,3 +879,118 @@ impl CliConfiguration<Self> for RelayChainCli {
|
||||
self.base.base.node_name()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{
|
||||
chain_spec::{get_account_id_from_seed, get_from_seed},
|
||||
command::{Runtime, RuntimeResolver},
|
||||
};
|
||||
use sc_chain_spec::{ChainSpec, ChainSpecExtension, ChainSpecGroup, ChainType, Extension};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_core::sr25519;
|
||||
use std::path::PathBuf;
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[derive(
|
||||
Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension, Default,
|
||||
)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Extensions1 {
|
||||
pub attribute1: String,
|
||||
pub attribute2: u32,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension, Default,
|
||||
)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Extensions2 {
|
||||
pub attribute_x: String,
|
||||
pub attribute_y: String,
|
||||
pub attribute_z: u32,
|
||||
}
|
||||
|
||||
fn store_configuration(dir: &TempDir, spec: Box<dyn ChainSpec>) -> PathBuf {
|
||||
let raw_output = true;
|
||||
let json = sc_service::chain_ops::build_spec(&*spec, raw_output)
|
||||
.expect("Failed to build json string");
|
||||
let mut cfg_file_path = dir.path().to_path_buf();
|
||||
cfg_file_path.push(spec.id());
|
||||
cfg_file_path.set_extension("json");
|
||||
std::fs::write(&cfg_file_path, json).expect("Failed to write to json file");
|
||||
cfg_file_path
|
||||
}
|
||||
|
||||
pub type DummyChainSpec<E> =
|
||||
sc_service::GenericChainSpec<rococo_parachain_runtime::GenesisConfig, E>;
|
||||
|
||||
pub fn create_default_with_extensions<E: Extension>(
|
||||
id: &str,
|
||||
extension: E,
|
||||
) -> DummyChainSpec<E> {
|
||||
DummyChainSpec::from_genesis(
|
||||
"Dummy local testnet",
|
||||
id,
|
||||
ChainType::Local,
|
||||
move || {
|
||||
crate::chain_spec::rococo_parachain::testnet_genesis(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
vec![
|
||||
get_from_seed::<rococo_parachain_runtime::AuraId>("Alice"),
|
||||
get_from_seed::<rococo_parachain_runtime::AuraId>("Bob"),
|
||||
],
|
||||
vec![get_account_id_from_seed::<sr25519::Public>("Alice")],
|
||||
1000.into(),
|
||||
)
|
||||
},
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
extension,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_resolve_runtime_for_different_configuration_files() {
|
||||
let temp_dir = tempfile::tempdir().expect("Failed to access tempdir");
|
||||
|
||||
let path = store_configuration(
|
||||
&temp_dir,
|
||||
Box::new(create_default_with_extensions("shell-1", Extensions1::default())),
|
||||
);
|
||||
assert_eq!(Runtime::Shell, path.runtime());
|
||||
|
||||
let path = store_configuration(
|
||||
&temp_dir,
|
||||
Box::new(create_default_with_extensions("shell-2", Extensions2::default())),
|
||||
);
|
||||
assert_eq!(Runtime::Shell, path.runtime());
|
||||
|
||||
let path = store_configuration(
|
||||
&temp_dir,
|
||||
Box::new(create_default_with_extensions("seedling", Extensions2::default())),
|
||||
);
|
||||
assert_eq!(Runtime::Seedling, path.runtime());
|
||||
|
||||
let path = store_configuration(
|
||||
&temp_dir,
|
||||
Box::new(crate::chain_spec::rococo_parachain::rococo_parachain_local_config()),
|
||||
);
|
||||
assert_eq!(Runtime::Default, path.runtime());
|
||||
|
||||
let path = store_configuration(
|
||||
&temp_dir,
|
||||
Box::new(crate::chain_spec::statemint::statemine_local_config()),
|
||||
);
|
||||
assert_eq!(Runtime::Statemine, path.runtime());
|
||||
|
||||
let path = store_configuration(
|
||||
&temp_dir,
|
||||
Box::new(crate::chain_spec::contracts::contracts_rococo_local_config()),
|
||||
);
|
||||
assert_eq!(Runtime::ContractsRococo, path.runtime());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,21 +69,6 @@ type HostFunctions = sp_io::SubstrateHostFunctions;
|
||||
type HostFunctions =
|
||||
(sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions);
|
||||
|
||||
/// Native executor instance.
|
||||
pub struct RococoParachainRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for RococoParachainRuntimeExecutor {
|
||||
type ExtendHostFunctions = ();
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
rococo_parachain_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
rococo_parachain_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
/// Native executor instance.
|
||||
pub struct ShellRuntimeExecutor;
|
||||
|
||||
@@ -99,21 +84,6 @@ impl sc_executor::NativeExecutionDispatch for ShellRuntimeExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
/// Native executor instance.
|
||||
pub struct SeedlingRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for SeedlingRuntimeExecutor {
|
||||
type ExtendHostFunctions = ();
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
seedling_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
seedling_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
// Native Statemint executor instance.
|
||||
pub struct StatemintRuntimeExecutor;
|
||||
|
||||
@@ -174,21 +144,6 @@ impl sc_executor::NativeExecutionDispatch for CollectivesPolkadotRuntimeExecutor
|
||||
}
|
||||
}
|
||||
|
||||
/// Native Contracts on Rococo executor instance.
|
||||
pub struct ContractsRococoRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for ContractsRococoRuntimeExecutor {
|
||||
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
contracts_rococo_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
contracts_rococo_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
/// Starts a `ServiceBuilder` for a full service.
|
||||
///
|
||||
/// Use this macro if you don't actually need the full service, but just the builder in order to
|
||||
|
||||
@@ -7,7 +7,7 @@ description = "Provides timestamp related functionality for parachains."
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ "derive" ] }
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.23"
|
||||
|
||||
# Substrate
|
||||
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{# This macro shows ONE change #}
|
||||
{%- macro change(c, cml="[C]", dot="[P]", sub="[S]") -%}
|
||||
|
||||
{%- if c.meta.C and c.meta.C.value >= 7 -%}
|
||||
{%- if c.meta.C and c.meta.C.value >= 5 -%}
|
||||
{%- set prio = " ‼️ HIGH" -%}
|
||||
{%- elif c.meta.C and c.meta.C.value >= 3 -%}
|
||||
{%- set prio = " ❗️ Medium" -%}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
{% include "changes_runtime.md.tera" %}
|
||||
|
||||
{% include "runtimes.md.tera" -%}
|
||||
{% endif %}
|
||||
|
||||
{% include "changes_misc.md.tera" %}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{%- if pr.meta.B.value == 0 -%}
|
||||
{#- We skip silent ones -#}
|
||||
{%- else -%}
|
||||
{%- if pr.meta.B and pr.meta.B.value != 5 and pr.meta.B.value != 7 or pr.meta.C or not pr.meta.B %}
|
||||
{%- if pr.meta.B and pr.meta.B.value != 5 or pr.meta.C or not pr.meta.B %}
|
||||
{%- set_global misc_count = misc_count + 1 -%}
|
||||
{%- endif -%}
|
||||
{% endif -%}
|
||||
@@ -27,7 +27,7 @@ There are other misc. changes. You can expand the list below to view them all.
|
||||
{%- if pr.meta.B.value == 0 %}
|
||||
{#- We skip silent ones -#}
|
||||
{%- else -%}
|
||||
{%- if pr.meta.B and pr.meta.B.value != 5 and pr.meta.B.value != 7 or pr.meta.C or not pr.meta.B %}
|
||||
{%- if pr.meta.B and pr.meta.B.value != 5 or pr.meta.C or not pr.meta.B %}
|
||||
- {{ m_c::change(c=pr) }}
|
||||
{%- endif -%}
|
||||
{% endif -%}
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
{#- The changes are sorted by merge date -#}
|
||||
{% for pr in changes | sort(attribute="merged_at") -%}
|
||||
|
||||
{%- if pr.meta.B -%}
|
||||
{%- if pr.meta.B and pr.meta.X -%}
|
||||
{%- if pr.meta.B.value == 0 -%}
|
||||
{#- We skip silent ones -#}
|
||||
{%- else -%}
|
||||
|
||||
{%- if pr.meta.B.value == 7 and not pr.title is containing("ompanion") %}
|
||||
{%- if pr.meta.B.value == 1 and pr.meta.X.value == 1 and not pr.title is containing("ompanion") %}
|
||||
- {{ m_c::change(c=pr) }}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
||||
{%- if p >= 7 or host_fn_count > 0 -%}
|
||||
{%- if p >= 5 or host_fn_count > 0 -%}
|
||||
{%- set prio = "‼️ HIGH" -%}
|
||||
{%- set text = "This is a **high priority** release and you must upgrade as as soon as possible." -%}
|
||||
{%- elif p >= 3 -%}
|
||||
@@ -45,7 +45,7 @@ The changes motivating this priority level are:
|
||||
{%- if pr.meta.C -%}
|
||||
{%- if pr.meta.C.value == p %}
|
||||
- {{ m_c::change(c=pr) }}
|
||||
{%- if pr.meta.B and pr.meta.B.value == 7 %}
|
||||
{%- if pr.meta.B and pr.meta.X and pr.meta.B.value == 1 and pr.meta.X.value == 1 %}
|
||||
(RUNTIME)
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -20,15 +20,14 @@ This release contains the changes from `{{ env.REF1 }}` to `{{ env.REF2 }}`.
|
||||
{# we will force it to HIGH if at least one host function was detected. #}
|
||||
|
||||
{% include "host_functions.md.tera" -%}
|
||||
|
||||
{% if env.RELEASE_TYPE and env.RELEASE_TYPE == "client" -%}
|
||||
{% include "global_priority.md.tera" -%}
|
||||
{% include "compiler.md.tera" -%}
|
||||
{% include "migrations-db.md.tera" -%}
|
||||
|
||||
{% if env.RELEASE_TYPE and env.RELEASE_TYPE == "client" %}
|
||||
{% include "migrations-db.md.tera" %}
|
||||
<!-- skipping runtime data for RELEASE_TYPE = {{ env.RELEASE_TYPE }} -->
|
||||
{% else %}
|
||||
{% include "migrations-runtime.md.tera" -%}
|
||||
|
||||
{% include "migrations-runtime.md.tera" %}
|
||||
{% include "runtimes.md.tera" -%}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -18,16 +18,15 @@ ensure_labels() {
|
||||
# Must have one of the following labels
|
||||
releasenotes_labels=(
|
||||
'B0-silent'
|
||||
'B1-releasenotes'
|
||||
'B7-runtimenoteworthy'
|
||||
'B1-note_worthy'
|
||||
)
|
||||
|
||||
# Must be an ordered list of priorities, lowest first
|
||||
priority_labels=(
|
||||
'C1-low 📌'
|
||||
'C3-medium 📣'
|
||||
'C7-high ❗️'
|
||||
'C9-critical ‼️'
|
||||
'C1-low'
|
||||
'C3-medium'
|
||||
'C5-high'
|
||||
'C7-critical'
|
||||
)
|
||||
|
||||
audit_labels=(
|
||||
@@ -38,6 +37,13 @@ audit_labels=(
|
||||
'D9-needsaudit 👮'
|
||||
)
|
||||
|
||||
x_labels=(
|
||||
'X0-node'
|
||||
'X1-runtime'
|
||||
'X2-API'
|
||||
'X9-misc'
|
||||
)
|
||||
|
||||
echo "[+] Checking release notes (B) labels for $CI_COMMIT_BRANCH"
|
||||
if ensure_labels "${releasenotes_labels[@]}"; then
|
||||
echo "[+] Release notes label detected. All is well."
|
||||
@@ -46,6 +52,16 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if has_label "$repo" "$pr" 'B1-note_worthy'; then
|
||||
echo "[+] B1-note_worthy is chosen. Checking that there X-labels for $CI_COMMIT_BRANCH"
|
||||
if ensure_labels "${x_labels[@]}"; then
|
||||
echo "[+] X-label detected. All is well."
|
||||
else
|
||||
echo "[!] X-label not detected. Please add one of: ${x_labels[*]}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "[+] Checking release priority (C) labels for $CI_COMMIT_BRANCH"
|
||||
if ensure_labels "${priority_labels[@]}"; then
|
||||
echo "[+] Release priority label detected. All is well."
|
||||
|
||||
@@ -102,7 +102,7 @@ impl RelayStateSproofBuilder {
|
||||
) -> (polkadot_primitives::v2::Hash, sp_state_machine::StorageProof) {
|
||||
let (db, root) = MemoryDB::<HashFor<polkadot_primitives::v2::Block>>::default_with_root();
|
||||
let state_version = Default::default(); // for test using default.
|
||||
let mut backend = sp_state_machine::TrieBackend::new(db, root);
|
||||
let mut backend = sp_state_machine::TrieBackendBuilder::new(db, root).build();
|
||||
|
||||
let mut relevant_keys = Vec::new();
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
serde = { version = "1.0.144", optional = true, features = ["derive"] }
|
||||
|
||||
# Substrate
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
@@ -10,12 +10,12 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
async-trait = "0.1.57"
|
||||
clap = { version = "3.2.16", features = ["derive", "deprecated"] }
|
||||
clap = { version = "3.2.17", features = ["derive", "deprecated"] }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||
criterion = { version = "0.3.6", features = [ "async_tokio" ] }
|
||||
jsonrpsee = { version = "0.15.1", features = ["server"] }
|
||||
rand = "0.8.5"
|
||||
serde = { version = "1.0.143", features = ["derive"] }
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
tokio = { version = "1.19.2", features = ["macros"] }
|
||||
tracing = "0.1.36"
|
||||
url = "2.2.2"
|
||||
@@ -72,7 +72,7 @@ cumulus-test-relay-validation-worker-provider = { path = "../relay-validation-wo
|
||||
cumulus-test-runtime = { path = "../runtime" }
|
||||
|
||||
[dev-dependencies]
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.23"
|
||||
portpicker = "0.1.1"
|
||||
|
||||
# Polkadot dependencies
|
||||
|
||||
+12
-5
@@ -191,8 +191,8 @@ impl CliConfiguration<Self> for RelayChainCli {
|
||||
self.base.base.transaction_pool(is_dev)
|
||||
}
|
||||
|
||||
fn state_cache_child_ratio(&self) -> CliResult<Option<usize>> {
|
||||
self.base.base.state_cache_child_ratio()
|
||||
fn trie_cache_maximum_size(&self) -> CliResult<Option<usize>> {
|
||||
self.base.base.trie_cache_maximum_size()
|
||||
}
|
||||
|
||||
fn rpc_methods(&self) -> CliResult<sc_service::config::RpcMethods> {
|
||||
@@ -288,9 +288,16 @@ impl SubstrateCli for TestCollatorCli {
|
||||
2017
|
||||
}
|
||||
|
||||
fn load_spec(&self, _: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
Ok(Box::new(cumulus_test_service::get_chain_spec(ParaId::from(self.parachain_id)))
|
||||
as Box<_>)
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
Ok(match id {
|
||||
"" => Box::new(cumulus_test_service::get_chain_spec(ParaId::from(self.parachain_id)))
|
||||
as Box<_>,
|
||||
path => {
|
||||
let chain_spec =
|
||||
cumulus_test_service::chain_spec::ChainSpec::from_json_file(path.into())?;
|
||||
Box::new(chain_spec)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
mod chain_spec;
|
||||
pub mod chain_spec;
|
||||
mod genesis;
|
||||
|
||||
use std::{
|
||||
@@ -650,8 +650,7 @@ pub fn node_config(
|
||||
keystore: KeystoreConfig::InMemory,
|
||||
keystore_remote: Default::default(),
|
||||
database: DatabaseSource::RocksDb { path: root.join("db"), cache_size: 128 },
|
||||
state_cache_size: 67108864,
|
||||
state_cache_child_ratio: None,
|
||||
trie_cache_maximum_size: Some(64 * 1024 * 1024),
|
||||
state_pruning: Some(PruningMode::ArchiveAll),
|
||||
blocks_pruning: BlocksPruning::All,
|
||||
chain_spec: spec,
|
||||
|
||||
+27
-10
@@ -16,7 +16,7 @@
|
||||
|
||||
mod cli;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::{io::Write, sync::Arc};
|
||||
|
||||
use cli::{RelayChainCli, Subcommand, TestCollatorCli};
|
||||
use cumulus_client_cli::generate_genesis_block;
|
||||
@@ -43,14 +43,31 @@ fn main() -> Result<(), sc_cli::Error> {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
|
||||
},
|
||||
Some(Subcommand::ExportGenesisState(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|_config| {
|
||||
let parachain_id = ParaId::from(cmd.parachain_id);
|
||||
let spec = cumulus_test_service::get_chain_spec(parachain_id);
|
||||
let state_version = cumulus_test_service::runtime::VERSION.state_version();
|
||||
cmd.base.run::<parachains_common::Block>(&spec, state_version)
|
||||
})
|
||||
|
||||
Some(Subcommand::ExportGenesisState(params)) => {
|
||||
let mut builder = sc_cli::LoggerBuilder::new("");
|
||||
builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
|
||||
let _ = builder.init();
|
||||
|
||||
let spec =
|
||||
cli.load_spec(¶ms.base.shared_params.chain.clone().unwrap_or_default())?;
|
||||
let state_version = cumulus_test_service::runtime::VERSION.state_version();
|
||||
|
||||
let block: parachains_common::Block = generate_genesis_block(&*spec, state_version)?;
|
||||
let raw_header = block.header().encode();
|
||||
let output_buf = if params.base.raw {
|
||||
raw_header
|
||||
} else {
|
||||
format!("0x{:?}", HexDisplay::from(&block.header().encode())).into_bytes()
|
||||
};
|
||||
|
||||
if let Some(output) = ¶ms.base.output {
|
||||
std::fs::write(output, output_buf)?;
|
||||
} else {
|
||||
std::io::stdout().write_all(&output_buf)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
},
|
||||
Some(Subcommand::ExportGenesisWasm(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
@@ -106,7 +123,7 @@ fn main() -> Result<(), sc_cli::Error> {
|
||||
if config.role.is_authority() { "yes" } else { "no" }
|
||||
);
|
||||
|
||||
let collator_key = Some(CollatorPair::generate().0);
|
||||
let collator_key = config.role.is_authority().then(|| CollatorPair::generate().0);
|
||||
|
||||
let consensus = cli
|
||||
.use_null_consensus
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Description: Small Network test
|
||||
Description: Sync blocks from tip without connected collator test
|
||||
Network: ./0001-sync_blocks_from_tip_without_connected_collator.toml
|
||||
Creds: config
|
||||
|
||||
@@ -7,11 +7,9 @@ alice: is up
|
||||
bob: is up
|
||||
charlie: is up
|
||||
dave: is up
|
||||
ferdie: is up
|
||||
eve: is up
|
||||
|
||||
alice: parachain 2000 is registered within 225 seconds
|
||||
alice: parachain 2000 block height is at least 10 within 250 seconds
|
||||
|
||||
ferdie: reports block height is at least 12 within 250 seconds
|
||||
eve: reports block height is at least 12 within 250 seconds
|
||||
eve: reports block height is at least 12 within 250 seconds
|
||||
@@ -1,5 +1,5 @@
|
||||
[relaychain]
|
||||
default_image = "docker.io/paritypr/polkadot-debug:master"
|
||||
default_image = "{{RELAY_IMAGE}}"
|
||||
default_command = "polkadot"
|
||||
default_args = [ "-lparachain=debug" ]
|
||||
|
||||
@@ -11,9 +11,7 @@ chain = "rococo-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
image = "docker.io/paritypr/polkadot-debug:5236-0.9.18-c55660e9-be16bd72"
|
||||
validator = true
|
||||
args = ["--database=paritydb-experimental"]
|
||||
|
||||
[[parachains]]
|
||||
id = 2000
|
||||
@@ -23,30 +21,30 @@ cumulus_based = true
|
||||
[[parachains.collators]]
|
||||
name = "charlie"
|
||||
validator = true
|
||||
image = "docker.io/parity/polkadot-collator:latest"
|
||||
command = "test-collator"
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["-lparachain=debug"]
|
||||
|
||||
# run dave as parachain full node
|
||||
[[parachains.collators]]
|
||||
name = "dave"
|
||||
validator = false
|
||||
image = "docker.io/parity/polkadot-collator:latest"
|
||||
command = "test-collator"
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["-lparachain=debug"]
|
||||
|
||||
# run eve as parachain full node that is only connected to dave
|
||||
[[parachains.collators]]
|
||||
name = "eve"
|
||||
validator = false
|
||||
image = "docker.io/parity/polkadot-collator:latest"
|
||||
command = "test-collator"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'dave'|zombie}}"]
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'dave'|zombie('multiAddress')}}"]
|
||||
|
||||
# run ferdie as parachain full node that is only connected to dave
|
||||
[[parachains.collators]]
|
||||
name = "ferdie"
|
||||
validator = false
|
||||
image = "docker.io/parity/polkadot-collator:latest"
|
||||
command = "test-collator"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'dave'|zombie}}"]
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'dave'|zombie('multiAddress')}}", "--relay-chain-rpc-url {{'alice'|zombie('wsUri')}}"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Description: Small Network test
|
||||
Description: PoV recovery test
|
||||
Network: ./0002-pov_recovery.toml
|
||||
Creds: config
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[relaychain]
|
||||
default_image = "docker.io/paritypr/polkadot-debug:master"
|
||||
default_image = "{{RELAY_IMAGE}}"
|
||||
default_command = "polkadot"
|
||||
default_args = [ "-lparachain=debug" ]
|
||||
|
||||
@@ -11,9 +11,7 @@ chain = "rococo-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
image = "docker.io/paritypr/polkadot-debug:5236-0.9.18-c55660e9-be16bd72"
|
||||
validator = true
|
||||
args = ["--database=paritydb-experimental"]
|
||||
|
||||
[[parachains]]
|
||||
id = 2000
|
||||
@@ -23,8 +21,8 @@ cumulus_based = true
|
||||
[[parachains.collators]]
|
||||
name = "charlie"
|
||||
validator = true
|
||||
image = "docker.io/parity/polkadot-collator:latest"
|
||||
command = "test-collator"
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["-lparachain=debug"]
|
||||
|
||||
# Run dave as parachain collator and eve as parachain full node
|
||||
@@ -33,14 +31,14 @@ cumulus_based = true
|
||||
[[parachains.collators]]
|
||||
name = "dave"
|
||||
validator = true
|
||||
image = "docker.io/parity/polkadot-collator:latest"
|
||||
command = "test-collator"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'charlie'|zombie}}", "--use-null-consensus", "--disable-block-announcements"]
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'charlie'|zombie('multiAddress')}}", "--use-null-consensus", "--disable-block-announcements"]
|
||||
|
||||
# run eve as parachain full node that is only connected to dave
|
||||
[[parachains.collators]]
|
||||
name = "eve"
|
||||
validator = false
|
||||
image = "docker.io/parity/polkadot-collator:latest"
|
||||
command = "test-collator"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'charlie'|zombie}}", "--use-null-consensus", "--disable-block-announcements"]
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'charlie'|zombie('multiAddress')}}", "--use-null-consensus", "--disable-block-announcements"]
|
||||
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
Description: Small Network test
|
||||
Network: ./0003-test_full_node_catching_up.toml
|
||||
Description: Full node catching up test
|
||||
Network: ./0003-full_node_catching_up.toml
|
||||
Creds: config
|
||||
|
||||
|
||||
alice: is up
|
||||
bob: is up
|
||||
charlie: is up
|
||||
+9
-11
@@ -1,5 +1,5 @@
|
||||
[relaychain]
|
||||
default_image = "docker.io/paritypr/polkadot-debug:master"
|
||||
default_image = "{{RELAY_IMAGE}}"
|
||||
default_command = "polkadot"
|
||||
default_args = [ "-lparachain=debug" ]
|
||||
|
||||
@@ -11,9 +11,7 @@ chain = "rococo-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
image = "docker.io/paritypr/polkadot-debug:5236-0.9.18-c55660e9-be16bd72"
|
||||
validator = true
|
||||
args = ["--database=paritydb-experimental"]
|
||||
|
||||
[[parachains]]
|
||||
id = 2000
|
||||
@@ -23,22 +21,22 @@ cumulus_based = true
|
||||
[[parachains.collators]]
|
||||
name = "charlie"
|
||||
validator = true
|
||||
image = "docker.io/parity/polkadot-collator:latest"
|
||||
command = "test-collator"
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["-lparachain=debug"]
|
||||
|
||||
# run cumulus dave (a parachain full node) and wait for it to sync some blocks
|
||||
[[parachains.collators]]
|
||||
name = "dave"
|
||||
validator = false
|
||||
image = "docker.io/parity/polkadot-collator:latest"
|
||||
command = "test-collator"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'charlie'|zombie}}"]
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'charlie'|zombie('multiAddress')}}"]
|
||||
|
||||
# run cumulus eve (a parachain full node) and wait for it to sync some blocks
|
||||
[[parachains.collators]]
|
||||
name = "eve"
|
||||
validator = false
|
||||
image = "docker.io/parity/polkadot-collator:latest"
|
||||
command = "test-collator"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'charlie'|zombie}}"]
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["--reserved-only", "--reserved-nodes {{'charlie'|zombie('multiAddress')}}", "--relay-chain-rpc-url {{'alice'|zombie('wsUri')}}"]
|
||||
@@ -0,0 +1,13 @@
|
||||
Description: Runtime Upgrade test
|
||||
Network: ./0004-runtime_upgrade.toml
|
||||
Creds: config
|
||||
|
||||
alice: is up
|
||||
bob: is up
|
||||
charlie: is up
|
||||
dave: is up
|
||||
alice: parachain 2000 is registered within 225 seconds
|
||||
charlie: reports block height is at least 5 within 250 seconds
|
||||
charlie: parachain 2000 perform upgrade with /tmp/wasm_binary_spec_version_incremented.rs.compact.compressed.wasm within 200 seconds
|
||||
dave: reports block height is at least 20 within 250 seconds
|
||||
dave: js-script ./runtime_upgrade.js within 200 seconds
|
||||
@@ -0,0 +1,33 @@
|
||||
[relaychain]
|
||||
default_image = "{{RELAY_IMAGE}}"
|
||||
default_command = "polkadot"
|
||||
default_args = [ "-lparachain=debug" ]
|
||||
|
||||
chain = "rococo-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
validator = true
|
||||
|
||||
[[parachains]]
|
||||
id = 2000
|
||||
cumulus_based = true
|
||||
|
||||
# run charlie as parachain collator
|
||||
[[parachains.collators]]
|
||||
name = "charlie"
|
||||
validator = true
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["-lparachain=debug"]
|
||||
|
||||
# Run dave as parachain full node
|
||||
[[parachains.collators]]
|
||||
name = "dave"
|
||||
validator = false
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
@@ -0,0 +1,13 @@
|
||||
Description: Migrate solo to para
|
||||
Network: ./0005-migrate_solo_to_para.toml
|
||||
Creds: config
|
||||
|
||||
alice: is up
|
||||
bob: is up
|
||||
dave: is up
|
||||
eve: is up
|
||||
alice: parachain 2000 is registered within 225 seconds
|
||||
alice: reports block height is at least 10 within 250 seconds
|
||||
alice: parachain 2000 block height is at least 10 within 250 seconds
|
||||
eve: reports block height is 0 within 20 seconds
|
||||
dave: js-script ./migrate_solo_to_para.js with "dave,2000-1,eve" within 200 seconds
|
||||
@@ -0,0 +1,45 @@
|
||||
[relaychain]
|
||||
default_image = "{{RELAY_IMAGE}}"
|
||||
default_command = "polkadot"
|
||||
default_args = [ "-lparachain=debug" ]
|
||||
|
||||
chain = "rococo-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
validator = true
|
||||
|
||||
|
||||
[[parachains]]
|
||||
id = 2000
|
||||
cumulus_based = true
|
||||
|
||||
# run the solo chain (in our case this is also already a parachain, but as it has a different genesis it will not produce any blocks.)
|
||||
[[parachains.collators]]
|
||||
name = "dave"
|
||||
validator = true
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["-lparachain=debug"]
|
||||
|
||||
[[parachains]]
|
||||
id = 2000
|
||||
cumulus_based = true
|
||||
add_to_genesis = false
|
||||
register_para = false
|
||||
# Set some random value in the genesis state to create a different genesis hash.
|
||||
[parachains.genesis.runtime.runtime_genesis_config.sudo]
|
||||
key = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"
|
||||
|
||||
# run the parachain that will be used to return the header of the solo chain.
|
||||
[[parachains.collators]]
|
||||
name = "eve"
|
||||
validator = true
|
||||
add_to_bootnodes = true
|
||||
image = "{{COL_IMAGE}}"
|
||||
command = "test-parachain"
|
||||
args = ["-lparachain=debug"]
|
||||
@@ -0,0 +1,57 @@
|
||||
const assert = require("assert");
|
||||
const polkadotApi = require("@polkadot/api");
|
||||
const utilCrypto = require("@polkadot/util-crypto");
|
||||
const fs = require("fs").promises;
|
||||
|
||||
async function connect(apiUrl, types) {
|
||||
const provider = new polkadotApi.WsProvider(apiUrl);
|
||||
const api = new polkadotApi.ApiPromise({ provider, types });
|
||||
await api.isReady;
|
||||
return api;
|
||||
}
|
||||
|
||||
async function run(nodeName, networkInfo, args) {
|
||||
const [paraNode, partialPath, soloNode ] = args;
|
||||
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[paraNode];
|
||||
const {wsUri: wsUri_solo, userDefinedTypes: userDefinedTypes_solo } = networkInfo.nodesByName[soloNode];
|
||||
const para = await connect(wsUri, userDefinedTypes);
|
||||
const solo = await connect(wsUri_solo, userDefinedTypes_solo);
|
||||
|
||||
await utilCrypto.cryptoWaitReady();
|
||||
|
||||
// account to submit tx
|
||||
const keyring = new polkadotApi.Keyring({ type: "sr25519" });
|
||||
const alice = keyring.addFromUri("//Alice");
|
||||
|
||||
// get genesis to update
|
||||
const filePath = `${networkInfo.tmpDir}/${partialPath}/genesis-state`;
|
||||
const customHeader = await fs.readFile(filePath);
|
||||
|
||||
// get current header
|
||||
await para.tx.testPallet.setCustomValidationHeadData(customHeader.toString()).signAndSend(alice);
|
||||
|
||||
let parachain_best;
|
||||
let count = 0;
|
||||
|
||||
assertParachainBest = async (parachain_best) => {
|
||||
const current = await para.rpc.chain.getHeader();
|
||||
assert.equal(parachain_best.toHuman().number, current.toHuman().number, "parachain should not produce more blocks");
|
||||
}
|
||||
|
||||
|
||||
await new Promise( async (resolve, reject) => {
|
||||
const unsubscribe = await solo.rpc.chain.subscribeNewHeads(async (header) => {
|
||||
console.log(`Solo chain is at block: #${header.number}`);
|
||||
count++;
|
||||
if(count === 2) parachain_best = await para.rpc.chain.getHeader();
|
||||
|
||||
if(count > 4) {
|
||||
unsubscribe();
|
||||
await assertParachainBest(parachain_best);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = { run }
|
||||
@@ -0,0 +1,24 @@
|
||||
const assert = require("assert");
|
||||
|
||||
async function run(nodeName, networkInfo, args) {
|
||||
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName];
|
||||
const api = await zombie.connect(wsUri, userDefinedTypes);
|
||||
|
||||
// get blockhash/runtimeVersion at block 1
|
||||
const hashAtBlock1 = await api.rpc.chain.getBlockHash(1);
|
||||
const versionAtBlock1 = await api.rpc.state.getRuntimeVersion(hashAtBlock1.toHuman());
|
||||
|
||||
// get blockhash/runtimeVersion at current head
|
||||
const currentHeader = await api.rpc.chain.getHeader();
|
||||
const hashAtCurrent = await api.rpc.chain.getBlockHash(currentHeader.number.toHuman());
|
||||
const versionAtCurrent = await api.rpc.state.getRuntimeVersion(hashAtCurrent.toHuman());
|
||||
|
||||
const oldVersionIncremented = parseInt(versionAtBlock1.specVersion.toHuman(),10) + 1;
|
||||
console.log("current", versionAtCurrent.specVersion.toHuman());
|
||||
console.log("oldVersionIncremented", oldVersionIncremented);
|
||||
|
||||
// 2 == 2
|
||||
assert.equal( oldVersionIncremented, versionAtCurrent.specVersion.toHuman(), "Running version should be the incremented version");
|
||||
}
|
||||
|
||||
module.exports = { run }
|
||||
Reference in New Issue
Block a user