Commit 9ff8c3ab authored by Arkadiy Paronyan's avatar Arkadiy Paronyan Committed by Gavin Wood
Browse files

Support both polkadot and kusama runtimes (#704)



* Allow both polkadot and kusama runtimes

* Allow both polkadot and kusama runtimes

* Make `collator` build

* Removed kusama runtime

* Introduced common runtime

* Updated for latest substrate

* Updated CI targets

* Updated CI version check

* Removed unused dependency

* Pulled latests substrate

* Pulled latest substrate

* Fixed version

* Apply suggestions from code review
Co-Authored-By: default avatarBastian Köcher <bkchr@users.noreply.github.com>

* NEW_HEADS_IDENTIFIER moved to primitives

* Updated CI check script

* Fixed script

* Set epoch duration for polkadot

* ci: check_runtime for both runtimes
Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: default avatargabriel klawitter <gabreal@users.noreply.github.com>
parent dd113a7b
Pipeline #73251 passed with stages
in 17 minutes and 17 seconds
...@@ -150,12 +150,12 @@ check-web-wasm: &test ...@@ -150,12 +150,12 @@ check-web-wasm: &test
script: script:
# WASM support is in progress. As more and more crates support WASM, we # WASM support is in progress. As more and more crates support WASM, we
# should add entries here. See https://github.com/paritytech/polkadot/issues/625 # should add entries here. See https://github.com/paritytech/polkadot/issues/625
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path executor/Cargo.toml - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path runtime/polkadot/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path runtime/kusama/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path erasure-coding/Cargo.toml - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path erasure-coding/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path parachain/Cargo.toml - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path parachain/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path primitives/Cargo.toml - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path primitives/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path rpc/Cargo.toml - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path rpc/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path runtime/Cargo.toml
- time cargo build --locked --target=wasm32-unknown-unknown --manifest-path statement-table/Cargo.toml - time cargo build --locked --target=wasm32-unknown-unknown --manifest-path statement-table/Cargo.toml
- sccache -s - sccache -s
......
...@@ -2029,6 +2029,72 @@ dependencies = [ ...@@ -2029,6 +2029,72 @@ dependencies = [
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "kusama-runtime"
version = "0.7.11"
dependencies = [
"bitvec 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
"frame-executive 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"frame-support 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"frame-system 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"frame-system-rpc-runtime-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libsecp256k1 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"pallet-authority-discovery 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-authorship 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-babe 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-balances 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-collective 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-democracy 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-elections-phragmen 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-finality-tracker 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-grandpa 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-identity 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-im-online 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-indices 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-membership 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-nicks 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-offences 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-randomness-collective-flip 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-session 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-staking 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-staking-reward-curve 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-timestamp 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-transaction-payment 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-transaction-payment-rpc-runtime-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-treasury 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-utility 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-parachain 0.7.11",
"polkadot-primitives 0.7.11",
"polkadot-runtime-common 0.7.10",
"rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
"sp-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-authority-discovery 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-block-builder 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-consensus-babe 0.8.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-core 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-inherents 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-io 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-keyring 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-offchain 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-session 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-staking 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-std 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-transaction-pool 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-trie 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-version 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"substrate-wasm-builder-runner 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"trie-db 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "kv-log-macro" name = "kv-log-macro"
version = "1.0.4" version = "1.0.4"
...@@ -3639,7 +3705,6 @@ dependencies = [ ...@@ -3639,7 +3705,6 @@ dependencies = [
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-erasure-coding 0.7.11", "polkadot-erasure-coding 0.7.11",
"polkadot-primitives 0.7.11", "polkadot-primitives 0.7.11",
"polkadot-runtime 0.7.11",
"sc-client 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sc-client 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-client-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sc-client-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-keystore 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sc-keystore 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
...@@ -3686,16 +3751,16 @@ dependencies = [ ...@@ -3686,16 +3751,16 @@ dependencies = [
"polkadot-cli 0.7.11", "polkadot-cli 0.7.11",
"polkadot-network 0.7.11", "polkadot-network 0.7.11",
"polkadot-primitives 0.7.11", "polkadot-primitives 0.7.11",
"polkadot-runtime 0.7.11",
"polkadot-service 0.7.11", "polkadot-service 0.7.11",
"polkadot-validation 0.7.11", "polkadot-validation 0.7.11",
"sc-client 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sc-client 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-client-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sc-client-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-network 0.8.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sc-network 0.8.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-blockchain 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-consensus 0.8.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-consensus 0.8.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-core 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-core 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-keyring 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-keyring 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"tokio 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
...@@ -3710,14 +3775,6 @@ dependencies = [ ...@@ -3710,14 +3775,6 @@ dependencies = [
"sp-trie 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-trie 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
] ]
[[package]]
name = "polkadot-executor"
version = "0.7.11"
dependencies = [
"polkadot-runtime 0.7.11",
"sc-executor 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
]
[[package]] [[package]]
name = "polkadot-network" name = "polkadot-network"
version = "0.7.11" version = "0.7.11"
...@@ -3774,6 +3831,7 @@ dependencies = [ ...@@ -3774,6 +3831,7 @@ dependencies = [
"sp-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-application-crypto 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-application-crypto 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-core 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-core 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-inherents 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-serializer 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-serializer 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-std 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-std 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
...@@ -3787,8 +3845,8 @@ version = "0.7.11" ...@@ -3787,8 +3845,8 @@ version = "0.7.11"
dependencies = [ dependencies = [
"jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"pallet-transaction-payment-rpc 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "pallet-transaction-payment-rpc 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-primitives 0.7.11", "polkadot-primitives 0.7.11",
"polkadot-runtime 0.7.11",
"sc-client 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sc-client 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-rpc 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sc-rpc 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
...@@ -3831,10 +3889,10 @@ dependencies = [ ...@@ -3831,10 +3889,10 @@ dependencies = [
"pallet-transaction-payment 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "pallet-transaction-payment 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-transaction-payment-rpc-runtime-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "pallet-transaction-payment-rpc-runtime-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-treasury 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "pallet-treasury 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-utility 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-parachain 0.7.11", "polkadot-parachain 0.7.11",
"polkadot-primitives 0.7.11", "polkadot-primitives 0.7.11",
"polkadot-runtime-common 0.7.10",
"rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
...@@ -3846,11 +3904,9 @@ dependencies = [ ...@@ -3846,11 +3904,9 @@ dependencies = [
"sp-consensus-babe 0.8.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-consensus-babe 0.8.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-core 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-core 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-inherents 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-inherents 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-io 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-keyring 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-keyring 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-offchain 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-offchain 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-serializer 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-session 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-session 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-staking 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-staking 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-std 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-std 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
...@@ -3862,21 +3918,63 @@ dependencies = [ ...@@ -3862,21 +3918,63 @@ dependencies = [
"trie-db 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "trie-db 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "polkadot-runtime-common"
version = "0.7.10"
dependencies = [
"bitvec 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
"frame-support 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"frame-system 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libsecp256k1 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"pallet-authorship 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-babe 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-balances 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-randomness-collective-flip 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-session 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-staking 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-staking-reward-curve 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-timestamp 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-treasury 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-parachain 0.7.11",
"polkadot-primitives 0.7.11",
"rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
"sp-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-core 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-inherents 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-io 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-keyring 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-staking 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-std 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-trie 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"trie-db 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "polkadot-service" name = "polkadot-service"
version = "0.7.11" version = "0.7.11"
dependencies = [ dependencies = [
"frame-system-rpc-runtime-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"kusama-runtime 0.7.11",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"pallet-babe 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "pallet-babe 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-im-online 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "pallet-im-online 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-staking 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "pallet-staking 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"pallet-transaction-payment-rpc-runtime-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-availability-store 0.7.11", "polkadot-availability-store 0.7.11",
"polkadot-executor 0.7.11",
"polkadot-network 0.7.11", "polkadot-network 0.7.11",
"polkadot-primitives 0.7.11", "polkadot-primitives 0.7.11",
"polkadot-rpc 0.7.11", "polkadot-rpc 0.7.11",
...@@ -3897,13 +3995,17 @@ dependencies = [ ...@@ -3897,13 +3995,17 @@ dependencies = [
"slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"sp-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-authority-discovery 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-authority-discovery 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-block-builder 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-blockchain 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-consensus 0.8.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-consensus 0.8.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-consensus-babe 0.8.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-consensus-babe 0.8.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-core 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-core 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-finality-grandpa 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-finality-grandpa 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-inherents 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-inherents 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-io 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-io 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-offchain 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-session 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-transaction-pool 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sp-transaction-pool 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
] ]
...@@ -3933,7 +4035,6 @@ dependencies = [ ...@@ -3933,7 +4035,6 @@ dependencies = [
"polkadot-erasure-coding 0.7.11", "polkadot-erasure-coding 0.7.11",
"polkadot-parachain 0.7.11", "polkadot-parachain 0.7.11",
"polkadot-primitives 0.7.11", "polkadot-primitives 0.7.11",
"polkadot-runtime 0.7.11",
"polkadot-statement-table 0.7.11", "polkadot-statement-table 0.7.11",
"sc-block-builder 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sc-block-builder 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-client-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)", "sc-client-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
......
...@@ -24,10 +24,11 @@ members = [ ...@@ -24,10 +24,11 @@ members = [
"cli", "cli",
"collator", "collator",
"erasure-coding", "erasure-coding",
"executor",
"network", "network",
"primitives", "primitives",
"runtime", "runtime/common",
"runtime/polkadot",
"runtime/kusama",
"service", "service",
"statement-table", "statement-table",
"service", "service",
...@@ -37,7 +38,8 @@ members = [ ...@@ -37,7 +38,8 @@ members = [
"test-parachains/adder/collator", "test-parachains/adder/collator",
] ]
exclude = [ exclude = [
"runtime/wasm", "runtime/polkadot/wasm",
"runtime/kusama/wasm",
"test-parachains/adder/wasm", "test-parachains/adder/wasm",
] ]
......
...@@ -8,7 +8,6 @@ edition = "2018" ...@@ -8,7 +8,6 @@ edition = "2018"
[dependencies] [dependencies]
polkadot-primitives = { path = "../primitives" } polkadot-primitives = { path = "../primitives" }
polkadot-erasure-coding = { path = "../erasure-coding" } polkadot-erasure-coding = { path = "../erasure-coding" }
polkadot-runtime = { path = "../runtime" }
parking_lot = "0.9.0" parking_lot = "0.9.0"
derive_more = "0.99" derive_more = "0.99"
log = "0.4.8" log = "0.4.8"
......
...@@ -41,12 +41,19 @@ impl Default for ChainSpec { ...@@ -41,12 +41,19 @@ impl Default for ChainSpec {
/// Get a chain config from a spec setting. /// Get a chain config from a spec setting.
impl ChainSpec { impl ChainSpec {
pub(crate) fn load(self) -> Result<service::ChainSpec, String> { pub(crate) fn load(self) -> Result<service::ChainSpec, String> {
Ok(match self { match self {
ChainSpec::Kusama => service::chain_spec::kusama_config()?, ChainSpec::Development => Ok(service::chain_spec::development_config()),
ChainSpec::Development => service::chain_spec::development_config(), ChainSpec::LocalTestnet => Ok(service::chain_spec::local_testnet_config()),
ChainSpec::LocalTestnet => service::chain_spec::local_testnet_config(), ChainSpec::StagingTestnet => Ok(service::chain_spec::staging_testnet_config()),
ChainSpec::StagingTestnet => service::chain_spec::staging_testnet_config(), ChainSpec::Kusama => service::chain_spec::kusama_config(),
}) }
}
pub(crate) fn is_kusama(&self) -> bool {
match self {
ChainSpec::Development | ChainSpec::LocalTestnet | ChainSpec::StagingTestnet => false,
ChainSpec::Kusama => true,
}
} }
pub(crate) fn from(s: &str) -> Option<Self> { pub(crate) fn from(s: &str) -> Option<Self> {
......
...@@ -26,53 +26,27 @@ mod browser; ...@@ -26,53 +26,27 @@ mod browser;
use chain_spec::ChainSpec; use chain_spec::ChainSpec;
use futures::{ use futures::{
Future, FutureExt, TryFutureExt, future::select, channel::oneshot, compat::Future01CompatExt, Future, FutureExt, TryFutureExt, future::select, channel::oneshot, compat::Future01CompatExt,
task::Spawn
}; };
use tokio::runtime::Runtime; use tokio::runtime::Runtime;
use log::{info, error}; use log::info;
use structopt::StructOpt; use structopt::StructOpt;
pub use service::{ pub use service::{
AbstractService, CustomConfiguration, AbstractService, CustomConfiguration, ProvideRuntimeApi, CoreApi, ParachainHost, IsKusama, self,
ProvideRuntimeApi, CoreApi, ParachainHost,
WrappedExecutor WrappedExecutor
}; };
pub use cli::{VersionInfo, IntoExit, NoCustom}; pub use cli::{VersionInfo, IntoExit, NoCustom, SharedParams};
pub use cli::{display_role, error}; pub use cli::{display_role, error};
fn load_spec(id: &str) -> Result<Option<service::ChainSpec>, String> { /// Load the `ChainSpec` for the given `id`.
pub fn load_spec(id: &str) -> Result<Option<service::ChainSpec>, String> {
Ok(match ChainSpec::from(id) { Ok(match ChainSpec::from(id) {
Some(spec) => Some(spec.load()?), Some(spec) => Some(spec.load()?),
None => None, None => None,
}) })
} }
/// Additional worker making use of the node, to run asynchronously before shutdown.
///
/// This will be invoked with the service and spawn a future that resolves
/// when complete.
pub trait Worker: IntoExit {
/// A future that resolves when the work is done or the node should exit.
/// This will be run on a tokio runtime.
type Work: Future<Output=()> + Unpin + Send + 'static;
/// Return configuration for the polkadot node.
// TODO: make this the full configuration, so embedded nodes don't need
// string CLI args (https://github.com/paritytech/polkadot/issues/111)
fn configuration(&self) -> service::CustomConfiguration { Default::default() }
/// Do work and schedule exit.
fn work<S, SC, B, CE, SP>(self, service: &S, spawner: SP) -> Self::Work
where S: AbstractService<Block = service::Block, RuntimeApi = service::RuntimeApi,
Backend = B, SelectChain = SC,
NetworkSpecialization = service::PolkadotProtocol, CallExecutor = CE>,
SC: service::SelectChain<service::Block> + 'static,
B: service::Backend<service::Block, service::Blake2Hasher> + 'static,
CE: service::CallExecutor<service::Block, service::Blake2Hasher> + Clone + Send + Sync + 'static,
SP: Spawn + Clone + Send + Sync + 'static;
}
#[derive(Debug, StructOpt, Clone)] #[derive(Debug, StructOpt, Clone)]
enum PolkadotSubCommands { enum PolkadotSubCommands {
#[structopt(name = "validation-worker", setting = structopt::clap::AppSettings::Hidden)] #[structopt(name = "validation-worker", setting = structopt::clap::AppSettings::Hidden)]
...@@ -96,81 +70,111 @@ struct PolkadotSubParams { ...@@ -96,81 +70,111 @@ struct PolkadotSubParams {
} }
/// Parses polkadot specific CLI arguments and run the service. /// Parses polkadot specific CLI arguments and run the service.
pub fn run<W>(worker: W, version: cli::VersionInfo) -> error::Result<()> where pub fn run<E: IntoExit>(exit: E, version: cli::VersionInfo) -> error::Result<()> {
W: Worker, let cmd = cli::parse_and_prepare::<PolkadotSubCommands, PolkadotSubParams, _>(
{
match cli::parse_and_prepare::<PolkadotSubCommands, PolkadotSubParams, _>(
&version, &version,
"parity-polkadot", "parity-polkadot",
std::env::args(), std::env::args(),
) { );
cli::ParseAndPrepare::Run(cmd) => cmd.run(load_spec, worker, if cmd
|worker, _cli_args, custom_args, mut config| { .shared_params()
info!("{}", version.name); .and_then(|p| p.chain.as_ref())
info!(" version {}", config.full_version()); .and_then(|c| ChainSpec::from(c))
info!(" by {}, 2017-2019", version.author); .map_or(false, |c| c.is_kusama())
info!("Chain specification: {}", config.chain_spec.name()); {
if config.chain_spec.name().starts_with("Kusama") { execute_cmd_with_runtime::<
info!("----------------------------"); service::kusama_runtime::RuntimeApi,
info!("This chain is not in any way"); service::KusamaExecutor,
info!(" endorsed by the "); service::kusama_runtime::UncheckedExtrinsic,
info!(" KUSAMA FOUNDATION "); _
info!("----------------------------"); >(exit, &version, cmd)
} } else {
info!("Node name: {}", config.name); execute_cmd_with_runtime::<
info!("Roles: {}", display_role(&config)); service::polkadot_runtime::RuntimeApi,
config.custom = worker.configuration(); service::PolkadotExecutor,
config.custom.authority_discovery_enabled = custom_args.authority_discovery_enabled; service::polkadot_runtime::UncheckedExtrinsic,
let runtime = Runtime::new().map_err(|e| format!("{:?}", e))?; _
match config.roles { >(exit, &version, cmd)
service::Roles::LIGHT => }
run_until_exit( }
runtime,
service::new_light(config).map_err(|e| format!("{:?}", e))?, /// Execute the given `cmd` with the given runtime.
worker fn execute_cmd_with_runtime<R, D, E, X>(
), exit: X,
_ => run_until_exit( version: &cli::VersionInfo,
cmd: cli::ParseAndPrepare<PolkadotSubCommands, PolkadotSubParams>,
) -> error::Result<()>
where
R: service::ConstructRuntimeApi<service::Block, service::TFullClient<service::Block, R, D>>
+ service::ConstructRuntimeApi<service::Block, service::TLightClient<service::Block, R, D>>
+ Send + Sync + 'static,
<R as service::ConstructRuntimeApi<service::Block, service::TFullClient<service::Block, R, D>>>::RuntimeApi: service::RuntimeApiCollection<E>,
<R as service::ConstructRuntimeApi<service::Block, service::TLightClient<service::Block, R, D>>>::RuntimeApi: service::RuntimeApiCollection<E>,
E: service::Codec + Send + Sync + 'static,
D: service::NativeExecutionDispatch + 'static,
X: IntoExit,
{
match cmd {
cli::ParseAndPrepare::Run(cmd) => cmd.run(&load_spec, exit,
|exit, _cli_args, custom_args, mut config| {
info!("{}", version.name);
info!(" version {}", config.full_version());
info!(" by {}, 2017-2019", version.author);
info!("Chain specification: {}", config.chain_spec.name());
if config.is_kusama() {
info!("----------------------------");
info!("This chain is not in any way");
info!(" endorsed by the ");
info!(" KUSAMA FOUNDATION ");
info!("----------------------------");
}
info!("Node name: {}", config.name);
info!("Roles: {}", display_role(&config));
config.custom = service::CustomConfiguration::default();
config.custom.authority_discovery_enabled = custom_args.authority_discovery_enabled;
let runtime = Runtime::new().map_err(|e| format!("{:?}", e))?;
match config.roles {
service::Roles::LIGHT =>
run_until_exit(
runtime,
service::new_light::<R, D, E>(config).map_err(|e| format!("{:?}", e))?,
exit.into_exit(),
),
_ => run_until_exit(
runtime, runtime,
service::new_full(config).map_err(|e| format!("{:?}", e))?, service::new_full::<R, D, E>(config).map_err(|e| format!("{:?}", e))?,
worker exit.into_exit(),
), ),
}.map_err(|e| format!("{:?}", e)) }.map_err(|e| format!("{:?}", e))
}), }),
cli::ParseAndPrepare::BuildSpec(cmd) => cmd.run::<NoCustom, _, _, _>(load_spec), cli::ParseAndPrepare::BuildSpec(cmd) => cmd.run::<NoCustom, _, _, _>(&load_spec),
cli::ParseAndPrepare::ExportBlocks(cmd) => cmd.run_with_builder::<(), _, _, _, _, _, _>(|config| cli::ParseAndPrepare::ExportBlocks(cmd) => cmd.run_with_builder::<_, _, _, _, _, _, _>(|config|
Ok(service::new_chain_ops(config)?), load_spec, worker),