mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +00:00
Add parachains for rococo (#144)
* Add parachains for rococo * Fix chain specs * Update to revert log rotation * Support selecting the chain in `export-genesis-state` * Add subcommand for exporting the genesis wasm of a Parachain * Update stuff * Fix `export-genesis-wasm` * Update the polkadot ref * Add bootNodes address * Add bootNodes address - track * Add bootNodes address - trick * Fix incorrect peer id (trick) * Fixes https://github.com/paritytech/cumulus/issues/157 * Update chainspecs * Update specs again * Set correct sudo account * Update properties * Update readme * Update `Cargo.lock` * Switch to rococo-branch Co-authored-by: Evaldo <contato@evaldofelipe.com> Co-authored-by: Cecile Tonglet <cecile.tonglet@cecton.com>
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
hard_tabs=true
|
hard_tabs=true
|
||||||
|
merge_imports=true
|
||||||
|
|||||||
Generated
+158
-155
File diff suppressed because it is too large
Load Diff
+27
-57
@@ -18,76 +18,46 @@ A planned wrapper around substrate runtimes to turn them into parachain validati
|
|||||||
|
|
||||||
A planned Polkadot collator for the parachain.
|
A planned Polkadot collator for the parachain.
|
||||||
|
|
||||||
## Running a collator
|
## Rococo
|
||||||
|
|
||||||
1. Checkout polkadot at `96f5dc510ef770fd5c5ab57a90565bb5819bbbea`.
|
Rococo is the testnet for parachains. It currently runs the parachains `Tick`, `Trick` and `Track`.
|
||||||
|
|
||||||
2. Run `Alice` and `Bob`:
|
### Running a collator
|
||||||
|
|
||||||
`cargo run --release -- --chain=${CUMULUS_REPO}/test/parachain/res/polkadot_chainspec.json --base-path=cumulus_relay_chain_node_0 --alice`
|
Collators are similar to validators in the relay chain. These nodes build the blocks that will eventually be included by the relay chain for a parachain.
|
||||||
|
|
||||||
`cargo run --release -- --chain=${CUMULUS_REPO}/test/parachain/res/polkadot_chainspec.json --base-path=cumulus_relay_chain_node_1 --bob --port 50666`
|
To run a collator on this test network you will need to compile the following binary:
|
||||||
|
|
||||||
Where `CUMULUS_REPO` is the path to the checkout of Cumulus.
|
```
|
||||||
|
cargo build --release -p cumulus-test-parachain-collator
|
||||||
3. Switch back to this repository and generate the parachain genesis state:
|
|
||||||
|
|
||||||
`cargo run --release -p cumulus-test-parachain-collator -- export-genesis-state genesis-state`
|
|
||||||
|
|
||||||
4. Run the collator:
|
|
||||||
|
|
||||||
`cargo run --release -p cumulus-test-parachain-collator -- --base-path cumulus_collator_path -- --bootnodes=/ip4/127.0.0.1/tcp/30333/p2p/PEER_ID_${NAME} --bootnodes=/ip4/127.0.0.1/tcp/50666/p2p/PEER_ID_${NAME}`
|
|
||||||
|
|
||||||
`PEER_ID_${NAME}` needs to be replaced with the peer id of the polkadot validator that uses `${NAME}`
|
|
||||||
as authority. The `--` after `--base-path cumulus_collator_path` is important, it tells the CLI to pass these arguments
|
|
||||||
to the relay chain node that is running inside of the collator.
|
|
||||||
|
|
||||||
5. Open `https://polkadot.js.org/apps/#/sudo` and register the parachain by calling `Registrar > RegisterPara`
|
|
||||||
|
|
||||||
`id`: `100`
|
|
||||||
|
|
||||||
`ParaInfo`: `Always`
|
|
||||||
|
|
||||||
`code`: `CUMULUS_REPO/target/release/wbuild/cumulus-test-parachain-runtime/cumulus_test_parachain_runtime.compact.wasm`
|
|
||||||
|
|
||||||
`initial_head_data`: Use the file you generated in step 3. (name: genesis-state)
|
|
||||||
|
|
||||||
Now your parachain should be registered and the collator should start building blocks and sending
|
|
||||||
them to the relay chain.
|
|
||||||
|
|
||||||
6. Now the `collator` should build blocks and the relay-chain should include them. You can check that the `parachain-header` for parachain `100` is changing.
|
|
||||||
|
|
||||||
### Running the collator automatically
|
|
||||||
|
|
||||||
To simplify the above process, you can run steps 1-5 above automatically:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
scripts/build_polkadot.sh
|
|
||||||
scripts/run_collator.sh
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This will churn for several minutes, but should end with docker reporting that several containers have successfully been brought up.
|
After the build is finished you can use the binary to run a collator for all three parachains:
|
||||||
|
|
||||||
To run step 6, first set up an alias which gives you quick access to the polkadot-js CLI:
|
```
|
||||||
|
./target/release/cumulus-test-parachain-collator --chain tick --validator
|
||||||
```sh
|
|
||||||
docker build -f docker/parachain-registrar.dockerfile --target pjs -t parachain-registrar:pjs .
|
|
||||||
alias pjs='docker run --rm --net cumulus_testing_net parachain-registrar:pjs --ws ws://172.28.1.1:9944'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Those steps should complete very quickly. At that point, you can do things like:
|
This will run the collator for the `Tick` parachain. To run a collator for one of the other nodes, the chain argument needs to be changed.
|
||||||
|
|
||||||
```sh
|
### Running a full node
|
||||||
$ pjs query.parachains.heads 100
|
|
||||||
{
|
To run a full node that should sync one of the parachains, you need to compile the following binary:
|
||||||
"heads": "0xe1efbf8cc2e1304da927986f4cd6964ce0888ce3995948bf71fe427b1a9d39b02101d2dac9c5342d7e8c4f4de2f5277ef860b3a518c1cd823b9a8cee175dce11bf7f57c5016e8a60a6cec16244b2cbf81a67a1dc7a825c288fc694997bc70e2d456400"
|
|
||||||
}
|
```
|
||||||
|
cargo build --release -p cumulus-test-parachain-collator
|
||||||
```
|
```
|
||||||
|
|
||||||
The collator includes its own health check, which you can inspect with
|
After the build is finished you can use the binary to run a collator for all three parachains:
|
||||||
|
|
||||||
```sh
|
```
|
||||||
docker inspect --format='{{json .State.Health}}' cumulus_collator_1
|
./target/release/cumulus-test-parachain-collator --chain tick
|
||||||
```
|
```
|
||||||
|
|
||||||
The check runs every 5 minutes, and takes about a minute to complete each time. Most of that time is spent sleeping; it remains a very lightweight process.
|
### Tick, Trick and Track
|
||||||
|
|
||||||
|
These are the parachains of Rococo, essentially all run the exact same runtime code. The only difference is the parachain ID they are registered
|
||||||
|
with on the relay chain. `Tick` is using `100`, `Trick` `110` and `Track` `120`. The parachains demonstrate message
|
||||||
|
passing between themselves and the relay chain. The message passing is currently implemented as a
|
||||||
|
HRMP (Horizontal Message Passing). This means that every message is send to the relay chain and from the relay
|
||||||
|
chain to its destination parachain.
|
||||||
|
|||||||
+19
-19
@@ -6,22 +6,22 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Substrate dependencies
|
# Substrate dependencies
|
||||||
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-core = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-service = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-service = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
|
|
||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
polkadot-collator = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-collator = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-validation = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-validation = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
|
|
||||||
# Cumulus dependencies
|
# Cumulus dependencies
|
||||||
cumulus-consensus = { path = "../consensus" }
|
cumulus-consensus = { path = "../consensus" }
|
||||||
@@ -41,13 +41,13 @@ test-runtime = { package = "cumulus-test-runtime", path = "../test/runtime" }
|
|||||||
test-client = { package = "cumulus-test-client", path = "../test/client" }
|
test-client = { package = "cumulus-test-client", path = "../test/client" }
|
||||||
|
|
||||||
# Substrate dependencies
|
# Substrate dependencies
|
||||||
substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
|
|
||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
|
|
||||||
# Other dependencies
|
# Other dependencies
|
||||||
env_logger = "0.7.1"
|
env_logger = "0.7.1"
|
||||||
|
|||||||
@@ -7,19 +7,19 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# substrate deps
|
# substrate deps
|
||||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-core = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
|
|
||||||
# polkadot deps
|
# polkadot deps
|
||||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
|
|
||||||
# other deps
|
# other deps
|
||||||
futures = { version = "0.3.1", features = ["compat"] }
|
futures = { version = "0.3.1", features = ["compat"] }
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# substrate deps
|
# substrate deps
|
||||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
frame-support = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
frame-system = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
frame-system = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-io = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-io = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-std = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
|
|
||||||
# Other dependencies
|
# Other dependencies
|
||||||
codec = { package = "parity-scale-codec", version = "1.3.0", features = [ "derive" ], default-features = false }
|
codec = { package = "parity-scale-codec", version = "1.3.0", features = [ "derive" ], default-features = false }
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
use codec::{Encode, Decode};
|
use codec::{Decode, Encode};
|
||||||
use cumulus_primitives::{
|
use cumulus_primitives::{
|
||||||
inherents::{DownwardMessagesType, DOWNWARD_MESSAGES_IDENTIFIER},
|
inherents::{DownwardMessagesType, DOWNWARD_MESSAGES_IDENTIFIER},
|
||||||
well_known_keys,
|
well_known_keys,
|
||||||
|
|||||||
+14
-14
@@ -7,18 +7,18 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# substrate deps
|
# substrate deps
|
||||||
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-core = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
|
|
||||||
# polkadot deps
|
# polkadot deps
|
||||||
polkadot-collator = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-collator = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-statement-table = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-statement-table = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-validation = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-validation = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-network = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-network = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
|
|
||||||
# cumulus deps
|
# cumulus deps
|
||||||
cumulus-primitives = { path = "../primitives" }
|
cumulus-primitives = { path = "../primitives" }
|
||||||
@@ -33,9 +33,9 @@ parking_lot = "0.10.2"
|
|||||||
cumulus-test-runtime = { path = "../test/runtime" }
|
cumulus-test-runtime = { path = "../test/runtime" }
|
||||||
|
|
||||||
# substrate deps
|
# substrate deps
|
||||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-core = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
|
|
||||||
# polkadot deps
|
# polkadot deps
|
||||||
polkadot-test-runtime-client = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-test-runtime-client = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
|
|||||||
@@ -11,27 +11,27 @@ cumulus-primitives = { path = "../primitives", default-features = false }
|
|||||||
cumulus-runtime = { path = "../runtime", default-features = false }
|
cumulus-runtime = { path = "../runtime", default-features = false }
|
||||||
|
|
||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
parachain = { package = "polkadot-parachain", git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch", default-features = false }
|
parachain = { package = "polkadot-parachain", git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false }
|
||||||
|
|
||||||
# Substrate dependencies
|
# Substrate dependencies
|
||||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
frame-support = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", version = "2.0.0-rc5", default-features = false }
|
sp-core = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", version = "2.0.0-rc5", default-features = false }
|
||||||
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-io = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-io = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-std = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-version = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-version = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
frame-system = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
frame-system = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
|
|
||||||
# Other Dependencies
|
# Other Dependencies
|
||||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"]}
|
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"]}
|
||||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
substrate-test-runtime-client = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
substrate-test-runtime-client = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-version = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-version = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ['std']
|
default = ['std']
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ use cumulus_primitives::{
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
decl_error, decl_event, decl_module, decl_storage, ensure, storage, weights::DispatchClass,
|
decl_error, decl_event, decl_module, decl_storage, ensure, storage, weights::DispatchClass,
|
||||||
};
|
};
|
||||||
|
use frame_system::ensure_none;
|
||||||
use parachain::primitives::RelayChainBlockNumber;
|
use parachain::primitives::RelayChainBlockNumber;
|
||||||
use sp_core::storage::well_known_keys;
|
use sp_core::storage::well_known_keys;
|
||||||
use sp_inherents::{InherentData, InherentIdentifier, ProvideInherent};
|
use sp_inherents::{InherentData, InherentIdentifier, ProvideInherent};
|
||||||
use sp_std::vec::Vec;
|
use sp_std::vec::Vec;
|
||||||
use frame_system::ensure_none;
|
|
||||||
|
|
||||||
/// A ValidationFunction is a compiled WASM blob which, on execution, validates parachain blocks.
|
/// A ValidationFunction is a compiled WASM blob which, on execution, validates parachain blocks.
|
||||||
pub type ValidationFunction = Vec<u8>;
|
pub type ValidationFunction = Vec<u8>;
|
||||||
@@ -239,6 +239,7 @@ mod tests {
|
|||||||
traits::{OnFinalize, OnInitialize},
|
traits::{OnFinalize, OnInitialize},
|
||||||
weights::Weight,
|
weights::Weight,
|
||||||
};
|
};
|
||||||
|
use frame_system::{InitKind, RawOrigin};
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
testing::Header,
|
testing::Header,
|
||||||
@@ -246,7 +247,6 @@ mod tests {
|
|||||||
Perbill,
|
Perbill,
|
||||||
};
|
};
|
||||||
use sp_version::RuntimeVersion;
|
use sp_version::RuntimeVersion;
|
||||||
use frame_system::{InitKind, RawOrigin};
|
|
||||||
|
|
||||||
impl_outer_origin! {
|
impl_outer_origin! {
|
||||||
pub enum Origin for Test where system = frame_system {}
|
pub enum Origin for Test where system = frame_system {}
|
||||||
@@ -547,7 +547,7 @@ mod tests {
|
|||||||
));
|
));
|
||||||
},
|
},
|
||||||
|| {
|
|| {
|
||||||
let events = dbg!(System::<Test>::events());
|
let events = System::<Test>::events();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
events[0].event,
|
events[0].event,
|
||||||
TestEvent::parachain_upgrade(Event::ValidationFunctionStored(1123))
|
TestEvent::parachain_upgrade(Event::ValidationFunctionStored(1123))
|
||||||
@@ -558,7 +558,7 @@ mod tests {
|
|||||||
1234,
|
1234,
|
||||||
|| {},
|
|| {},
|
||||||
|| {
|
|| {
|
||||||
let events = dbg!(System::<Test>::events());
|
let events = System::<Test>::events();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
events[0].event,
|
events[0].event,
|
||||||
TestEvent::parachain_upgrade(Event::ValidationFunctionApplied(1234))
|
TestEvent::parachain_upgrade(Event::ValidationFunctionApplied(1234))
|
||||||
|
|||||||
@@ -6,20 +6,20 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Substrate dependencies
|
# Substrate dependencies
|
||||||
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-std = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
|
|
||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch", default-features = false }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false }
|
||||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch", default-features = false }
|
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false }
|
||||||
|
|
||||||
# Other dependencies
|
# Other dependencies
|
||||||
codec = { package = "parity-scale-codec", version = "1.0.5", default-features = false, features = [ "derive" ] }
|
codec = { package = "parity-scale-codec", version = "1.0.5", default-features = false, features = [ "derive" ] }
|
||||||
impl-trait-for-tuples = "0.1.3"
|
impl-trait-for-tuples = "0.1.3"
|
||||||
|
|
||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch", default-features = false }
|
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [ "std" ]
|
default = [ "std" ]
|
||||||
|
|||||||
@@ -25,8 +25,9 @@ pub use polkadot_core_primitives::DownwardMessage;
|
|||||||
/// It is "generic" in such a way, that the actual message is encoded in the `data` field.
|
/// It is "generic" in such a way, that the actual message is encoded in the `data` field.
|
||||||
/// Besides the `data` it also holds the `origin` of the message.
|
/// Besides the `data` it also holds the `origin` of the message.
|
||||||
pub use polkadot_parachain::primitives::UpwardMessage as GenericUpwardMessage;
|
pub use polkadot_parachain::primitives::UpwardMessage as GenericUpwardMessage;
|
||||||
pub use polkadot_parachain::primitives::ParachainDispatchOrigin as UpwardMessageOrigin;
|
pub use polkadot_parachain::primitives::{
|
||||||
pub use polkadot_parachain::primitives::Id as ParaId;
|
Id as ParaId, ParachainDispatchOrigin as UpwardMessageOrigin,
|
||||||
|
};
|
||||||
|
|
||||||
pub mod validation_function_params;
|
pub mod validation_function_params;
|
||||||
pub mod xcmp;
|
pub mod xcmp;
|
||||||
@@ -47,7 +48,8 @@ pub mod inherents {
|
|||||||
/// The identifier for the `validation_function_params` inherent.
|
/// The identifier for the `validation_function_params` inherent.
|
||||||
pub const VALIDATION_FUNCTION_PARAMS_IDENTIFIER: InherentIdentifier = *b"valfunp0";
|
pub const VALIDATION_FUNCTION_PARAMS_IDENTIFIER: InherentIdentifier = *b"valfunp0";
|
||||||
/// The type of the inherent.
|
/// The type of the inherent.
|
||||||
pub type ValidationFunctionParamsType = crate::validation_function_params::ValidationFunctionParams;
|
pub type ValidationFunctionParamsType =
|
||||||
|
crate::validation_function_params::ValidationFunctionParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Well known keys for values in the storage.
|
/// Well known keys for values in the storage.
|
||||||
|
|||||||
+12
-12
@@ -16,22 +16,22 @@ hashbrown = "0.8.0"
|
|||||||
cumulus-primitives = { path = "../primitives", default-features = false }
|
cumulus-primitives = { path = "../primitives", default-features = false }
|
||||||
|
|
||||||
# Substrate dependencies
|
# Substrate dependencies
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-trie = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-trie = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
|
|
||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
parachain = { package = "polkadot-parachain", git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch", default-features = false, features = [ "wasm-api" ] }
|
parachain = { package = "polkadot-parachain", git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false, features = [ "wasm-api" ] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
sc-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sc-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
test-client = { package = "cumulus-test-client", path = "../test/client" }
|
test-client = { package = "cumulus-test-client", path = "../test/client" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
///! The Cumulus runtime to make a runtime a parachain.
|
///! The Cumulus runtime to make a runtime a parachain.
|
||||||
|
|
||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
use sp_runtime::traits::Block as BlockT;
|
use sp_runtime::traits::Block as BlockT;
|
||||||
use sp_std::vec::Vec;
|
use sp_std::vec::Vec;
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
sc-service = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-service = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
test-client = { package = "substrate-test-client", git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
test-client = { package = "substrate-test-client", git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
runtime = { package = "cumulus-test-runtime", path = "../runtime" }
|
runtime = { package = "cumulus-test-runtime", path = "../runtime" }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-core = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
codec = { package = "parity-scale-codec", version = "1.0.5", default-features = false, features = [ "derive" ] }
|
codec = { package = "parity-scale-codec", version = "1.0.5", default-features = false, features = [ "derive" ] }
|
||||||
sp-test-primitives = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-test-primitives = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
|
|||||||
@@ -19,31 +19,33 @@ trie-root = '0.15.2'
|
|||||||
codec = { package = 'parity-scale-codec', version = '1.0.0' }
|
codec = { package = 'parity-scale-codec', version = '1.0.0' }
|
||||||
structopt = "0.3.3"
|
structopt = "0.3.3"
|
||||||
ansi_term = "0.12.1"
|
ansi_term = "0.12.1"
|
||||||
|
serde = { version = "1.0.101", features = ["derive"] }
|
||||||
|
hex-literal = "0.2.1"
|
||||||
|
|
||||||
# Parachain dependencies
|
# Parachain dependencies
|
||||||
parachain-runtime = { package = "cumulus-test-parachain-runtime", path = "runtime" }
|
parachain-runtime = { package = "cumulus-test-parachain-runtime", path = "runtime" }
|
||||||
|
|
||||||
# Substrate dependencies
|
# Substrate dependencies
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-io = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-io = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-core = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-service = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-service = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-network = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-network = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", version = "0.8.0-rc5" }
|
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", version = "0.8.0-rc5" }
|
||||||
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sp-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-informant = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-informant = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
|
|
||||||
# Cumulus dependencies
|
# Cumulus dependencies
|
||||||
cumulus-consensus = { path = "../../consensus" }
|
cumulus-consensus = { path = "../../consensus" }
|
||||||
@@ -52,15 +54,15 @@ cumulus-network = { path = "../../network" }
|
|||||||
cumulus-primitives = { path = "../../primitives" }
|
cumulus-primitives = { path = "../../primitives" }
|
||||||
|
|
||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-collator = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-collator = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-test-service = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-test-service = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_cmd = "0.12"
|
assert_cmd = "0.12"
|
||||||
@@ -69,12 +71,12 @@ rand = "0.7.3"
|
|||||||
tokio = { version = "0.2.13", features = ["macros"] }
|
tokio = { version = "0.2.13", features = ["macros"] }
|
||||||
|
|
||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-test-runtime = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-test-runtime = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-test-runtime-client = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-test-runtime-client = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
polkadot-test-service = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
|
polkadot-test-service = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
|
||||||
|
|
||||||
# Substrate dependencies
|
# Substrate dependencies
|
||||||
pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
substrate-test-runtime-client = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch" }
|
substrate-test-runtime-client = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -9,26 +9,26 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
|||||||
codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] }
|
codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
# Substrate dependencies
|
# Substrate dependencies
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
|
|
||||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch" }
|
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch" }
|
||||||
|
|
||||||
# Cumulus dependencies
|
# Cumulus dependencies
|
||||||
cumulus-runtime = { path = "../../../runtime", default-features = false }
|
cumulus-runtime = { path = "../../../runtime", default-features = false }
|
||||||
@@ -38,7 +38,7 @@ cumulus-upward-message = { path = "../../../upward-message", default-features =
|
|||||||
cumulus-primitives = { path = "../../../primitives", default-features = false }
|
cumulus-primitives = { path = "../../../primitives", default-features = false }
|
||||||
|
|
||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch", default-features = false }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.6" }
|
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.6" }
|
||||||
|
|||||||
@@ -101,11 +101,11 @@ pub mod opaque {
|
|||||||
|
|
||||||
/// This runtime version.
|
/// This runtime version.
|
||||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||||
spec_name: create_runtime_str!("wasm-test-parachain"),
|
spec_name: create_runtime_str!("cumulus-test-parachain"),
|
||||||
impl_name: create_runtime_str!("wasm-test-parachain"),
|
impl_name: create_runtime_str!("cumulus-test-parachain"),
|
||||||
authoring_version: 3,
|
authoring_version: 1,
|
||||||
spec_version: 4,
|
spec_version: 1,
|
||||||
impl_version: 4,
|
impl_version: 1,
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
transaction_version: 1,
|
transaction_version: 1,
|
||||||
};
|
};
|
||||||
@@ -250,7 +250,7 @@ parameter_types! {
|
|||||||
impl cumulus_message_broker::Trait for Runtime {
|
impl cumulus_message_broker::Trait for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type DownwardMessageHandlers = TokenDealer;
|
type DownwardMessageHandlers = TokenDealer;
|
||||||
type UpwardMessage = cumulus_upward_message::WestendUpwardMessage;
|
type UpwardMessage = cumulus_upward_message::RococoUpwardMessage;
|
||||||
type ParachainId = ParachainId;
|
type ParachainId = ParachainId;
|
||||||
type XCMPMessage = XCMPMessage<AccountId, Balance>;
|
type XCMPMessage = XCMPMessage<AccountId, Balance>;
|
||||||
type XCMPMessageHandlers = TokenDealer;
|
type XCMPMessageHandlers = TokenDealer;
|
||||||
@@ -259,7 +259,7 @@ impl cumulus_message_broker::Trait for Runtime {
|
|||||||
impl message_example::Trait for Runtime {
|
impl message_example::Trait for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type UpwardMessageSender = MessageBroker;
|
type UpwardMessageSender = MessageBroker;
|
||||||
type UpwardMessage = cumulus_upward_message::WestendUpwardMessage;
|
type UpwardMessage = cumulus_upward_message::RococoUpwardMessage;
|
||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
type XCMPMessageSender = MessageBroker;
|
type XCMPMessageSender = MessageBroker;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,15 @@ use parachain_runtime::{
|
|||||||
AccountId, BalancesConfig, GenesisConfig, Signature, SudoConfig, SystemConfig,
|
AccountId, BalancesConfig, GenesisConfig, Signature, SudoConfig, SystemConfig,
|
||||||
TokenDealerConfig, WASM_BINARY,
|
TokenDealerConfig, WASM_BINARY,
|
||||||
};
|
};
|
||||||
|
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
|
||||||
use sc_service::ChainType;
|
use sc_service::ChainType;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use sp_core::{sr25519, Pair, Public};
|
use sp_core::{sr25519, Pair, Public};
|
||||||
use sp_runtime::traits::{IdentifyAccount, Verify};
|
use sp_runtime::traits::{IdentifyAccount, Verify};
|
||||||
|
use hex_literal::hex;
|
||||||
|
|
||||||
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
|
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
|
||||||
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>;
|
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig, Extensions>;
|
||||||
|
|
||||||
/// Helper function to generate a crypto pair from seed
|
/// Helper function to generate a crypto pair from seed
|
||||||
pub fn get_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 {
|
||||||
@@ -33,6 +36,23 @@ pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Pu
|
|||||||
.public()
|
.public()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The extensions for the [`ChainSpec`].
|
||||||
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
pub struct Extensions {
|
||||||
|
/// The relay chain of the Parachain.
|
||||||
|
pub relay_chain: String,
|
||||||
|
/// The id of the Parachain.
|
||||||
|
pub para_id: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Extensions {
|
||||||
|
/// Try to get the extension from the given `ChainSpec`.
|
||||||
|
pub fn try_get(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Option<&Self> {
|
||||||
|
sc_chain_spec::get_extension(chain_spec.extensions())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type AccountPublic = <Signature as Verify>::Signer;
|
type AccountPublic = <Signature as Verify>::Signer;
|
||||||
|
|
||||||
/// Helper function to generate an account ID from seed
|
/// Helper function to generate an account ID from seed
|
||||||
@@ -72,7 +92,33 @@ pub fn get_chain_spec(id: ParaId) -> ChainSpec {
|
|||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
Extensions {
|
||||||
|
relay_chain: "westend-dev".into(),
|
||||||
|
para_id: id.into(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn staging_test_net(id: ParaId) -> ChainSpec {
|
||||||
|
ChainSpec::from_genesis(
|
||||||
|
"Staging Testnet",
|
||||||
|
"staging_testnet",
|
||||||
|
ChainType::Live,
|
||||||
|
move || {
|
||||||
|
testnet_genesis(
|
||||||
|
hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into(),
|
||||||
|
vec![hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into()],
|
||||||
|
id,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
Vec::new(),
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
Extensions {
|
||||||
|
relay_chain: "westend-dev".into(),
|
||||||
|
para_id: id.into(),
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ pub enum Subcommand {
|
|||||||
/// Export the genesis state of the parachain.
|
/// Export the genesis state of the parachain.
|
||||||
#[structopt(name = "export-genesis-state")]
|
#[structopt(name = "export-genesis-state")]
|
||||||
ExportGenesisState(ExportGenesisStateCommand),
|
ExportGenesisState(ExportGenesisStateCommand),
|
||||||
|
|
||||||
|
/// Export the genesis wasm of the parachain.
|
||||||
|
#[structopt(name = "export-genesis-wasm")]
|
||||||
|
ExportGenesisWasm(ExportGenesisWasmCommand),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Command for exporting the genesis state of the parachain
|
/// Command for exporting the genesis state of the parachain
|
||||||
@@ -40,6 +44,22 @@ pub struct ExportGenesisStateCommand {
|
|||||||
/// Id of the parachain this state is for.
|
/// Id of the parachain this state is for.
|
||||||
#[structopt(long, default_value = "100")]
|
#[structopt(long, default_value = "100")]
|
||||||
pub parachain_id: u32,
|
pub parachain_id: u32,
|
||||||
|
|
||||||
|
/// The name of the chain for that the genesis state should be exported.
|
||||||
|
#[structopt(long)]
|
||||||
|
pub chain: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Command for exporting the genesis wasm file.
|
||||||
|
#[derive(Debug, StructOpt)]
|
||||||
|
pub struct ExportGenesisWasmCommand {
|
||||||
|
/// Output file name or stdout if unspecified.
|
||||||
|
#[structopt(parse(from_os_str))]
|
||||||
|
pub output: Option<PathBuf>,
|
||||||
|
|
||||||
|
/// The name of the chain for that the genesis wasm file should be exported.
|
||||||
|
#[structopt(long)]
|
||||||
|
pub chain: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
@@ -48,8 +68,8 @@ pub struct RunCmd {
|
|||||||
pub base: sc_cli::RunCmd,
|
pub base: sc_cli::RunCmd,
|
||||||
|
|
||||||
/// Id of the parachain this collator collates for.
|
/// Id of the parachain this collator collates for.
|
||||||
#[structopt(long, default_value = "100")]
|
#[structopt(long)]
|
||||||
pub parachain_id: u32,
|
pub parachain_id: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::ops::Deref for RunCmd {
|
impl std::ops::Deref for RunCmd {
|
||||||
@@ -78,11 +98,29 @@ pub struct Cli {
|
|||||||
pub relaychain_args: Vec<String>,
|
pub relaychain_args: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug)]
|
||||||
pub struct PolkadotCli {
|
pub struct RelayChainCli {
|
||||||
#[structopt(flatten)]
|
/// The actual relay chain cli object.
|
||||||
pub base: polkadot_cli::RunCmd,
|
pub base: polkadot_cli::RunCmd,
|
||||||
|
|
||||||
#[structopt(skip)]
|
/// Optional chain id that should be passed to the relay chain.
|
||||||
|
pub chain_id: Option<String>,
|
||||||
|
|
||||||
|
/// The base path that should be used by the relay chain.
|
||||||
pub base_path: Option<PathBuf>,
|
pub base_path: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl RelayChainCli {
|
||||||
|
/// Create a new instance of `Self`.
|
||||||
|
pub fn new<'a>(
|
||||||
|
base_path: Option<PathBuf>,
|
||||||
|
chain_id: Option<String>,
|
||||||
|
relay_chain_args: impl Iterator<Item = &'a String>,
|
||||||
|
) -> Self {
|
||||||
|
Self {
|
||||||
|
base_path,
|
||||||
|
chain_id,
|
||||||
|
base: polkadot_cli::RunCmd::from_iter(relay_chain_args),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,8 +14,10 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::chain_spec;
|
use crate::{
|
||||||
use crate::cli::{Cli, PolkadotCli, Subcommand};
|
chain_spec,
|
||||||
|
cli::{Cli, RelayChainCli, Subcommand},
|
||||||
|
};
|
||||||
use codec::Encode;
|
use codec::Encode;
|
||||||
use cumulus_primitives::ParaId;
|
use cumulus_primitives::ParaId;
|
||||||
use log::info;
|
use log::info;
|
||||||
@@ -27,11 +29,8 @@ use sc_cli::{
|
|||||||
};
|
};
|
||||||
use sc_service::config::{BasePath, PrometheusConfig};
|
use sc_service::config::{BasePath, PrometheusConfig};
|
||||||
use sp_core::hexdisplay::HexDisplay;
|
use sp_core::hexdisplay::HexDisplay;
|
||||||
use sp_runtime::{
|
use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, Zero};
|
||||||
traits::{Block as BlockT, Hash as HashT, Header as HeaderT, Zero},
|
use std::{io::Write, net::SocketAddr, sync::Arc};
|
||||||
BuildStorage,
|
|
||||||
};
|
|
||||||
use std::{net::SocketAddr, sync::Arc};
|
|
||||||
|
|
||||||
impl SubstrateCli for Cli {
|
impl SubstrateCli for Cli {
|
||||||
fn impl_name() -> String {
|
fn impl_name() -> String {
|
||||||
@@ -64,11 +63,27 @@ impl SubstrateCli for Cli {
|
|||||||
2017
|
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 sc_service::ChainSpec>, String> {
|
||||||
// Such a hack :(
|
match id {
|
||||||
Ok(Box::new(chain_spec::get_chain_spec(
|
"staging" => Ok(Box::new(chain_spec::staging_test_net(
|
||||||
self.run.parachain_id.into(),
|
self.run.parachain_id.unwrap_or(100).into(),
|
||||||
)))
|
))),
|
||||||
|
"tick" => Ok(Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||||
|
&include_bytes!("../res/tick.json")[..],
|
||||||
|
)?)),
|
||||||
|
"trick" => Ok(Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||||
|
&include_bytes!("../res/trick.json")[..],
|
||||||
|
)?)),
|
||||||
|
"track" => Ok(Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||||
|
&include_bytes!("../res/track.json")[..],
|
||||||
|
)?)),
|
||||||
|
"" => Ok(Box::new(chain_spec::get_chain_spec(
|
||||||
|
self.run.parachain_id.unwrap_or(100).into(),
|
||||||
|
))),
|
||||||
|
path => Ok(Box::new(chain_spec::ChainSpec::from_json_file(
|
||||||
|
path.into(),
|
||||||
|
)?)),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
|
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
|
||||||
@@ -76,7 +91,7 @@ impl SubstrateCli for Cli {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SubstrateCli for PolkadotCli {
|
impl SubstrateCli for RelayChainCli {
|
||||||
fn impl_name() -> String {
|
fn impl_name() -> String {
|
||||||
"Cumulus Test Parachain Collator".into()
|
"Cumulus Test Parachain Collator".into()
|
||||||
}
|
}
|
||||||
@@ -106,7 +121,7 @@ impl SubstrateCli for PolkadotCli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 sc_service::ChainSpec>, String> {
|
||||||
polkadot_cli::Cli::from_iter([PolkadotCli::executable_name().to_string()].iter())
|
polkadot_cli::Cli::from_iter([RelayChainCli::executable_name().to_string()].iter())
|
||||||
.load_spec(id)
|
.load_spec(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,9 +130,8 @@ impl SubstrateCli for PolkadotCli {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generate the genesis block
|
pub fn generate_genesis_state(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Result<Block> {
|
||||||
pub fn generate_genesis_state(para_id: ParaId) -> Result<Block> {
|
let storage = chain_spec.build_storage()?;
|
||||||
let storage = (&chain_spec::get_chain_spec(para_id)).build_storage()?;
|
|
||||||
|
|
||||||
let child_roots = storage.children_default.iter().map(|(sk, child_content)| {
|
let child_roots = storage.children_default.iter().map(|(sk, child_content)| {
|
||||||
let state_root = <<<Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
|
let state_root = <<<Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
|
||||||
@@ -144,6 +158,15 @@ pub fn generate_genesis_state(para_id: ParaId) -> Result<Block> {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn extract_genesis_wasm(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Result<Vec<u8>> {
|
||||||
|
let mut storage = chain_spec.build_storage()?;
|
||||||
|
|
||||||
|
storage
|
||||||
|
.top
|
||||||
|
.remove(sp_core::storage::well_known_keys::CODE)
|
||||||
|
.ok_or_else(|| "Could not find wasm file in genesis state!".into())
|
||||||
|
}
|
||||||
|
|
||||||
/// Parse command line arguments into service configuration.
|
/// Parse command line arguments into service configuration.
|
||||||
pub fn run() -> Result<()> {
|
pub fn run() -> Result<()> {
|
||||||
let cli = Cli::from_args();
|
let cli = Cli::from_args();
|
||||||
@@ -166,7 +189,8 @@ pub fn run() -> Result<()> {
|
|||||||
Some(Subcommand::ExportGenesisState(params)) => {
|
Some(Subcommand::ExportGenesisState(params)) => {
|
||||||
sc_cli::init_logger("");
|
sc_cli::init_logger("");
|
||||||
|
|
||||||
let block = generate_genesis_state(params.parachain_id.into())?;
|
let block =
|
||||||
|
generate_genesis_state(&cli.load_spec(¶ms.chain.clone().unwrap_or_default())?)?;
|
||||||
let header_hex = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
|
let header_hex = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
|
||||||
|
|
||||||
if let Some(output) = ¶ms.output {
|
if let Some(output) = ¶ms.output {
|
||||||
@@ -177,29 +201,47 @@ pub fn run() -> Result<()> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Some(Subcommand::ExportGenesisWasm(params)) => {
|
||||||
|
sc_cli::init_logger("");
|
||||||
|
|
||||||
|
let wasm_file =
|
||||||
|
extract_genesis_wasm(&cli.load_spec(¶ms.chain.clone().unwrap_or_default())?)?;
|
||||||
|
|
||||||
|
if let Some(output) = ¶ms.output {
|
||||||
|
std::fs::write(output, wasm_file)?;
|
||||||
|
} else {
|
||||||
|
std::io::stdout().write_all(&wasm_file)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
None => {
|
None => {
|
||||||
let runner = cli.create_runner(&*cli.run)?;
|
let runner = cli.create_runner(&*cli.run)?;
|
||||||
|
|
||||||
// TODO
|
|
||||||
let key = Arc::new(sp_core::Pair::generate().0);
|
|
||||||
|
|
||||||
let mut polkadot_cli = PolkadotCli::from_iter(
|
|
||||||
[PolkadotCli::executable_name().to_string()]
|
|
||||||
.iter()
|
|
||||||
.chain(cli.relaychain_args.iter()),
|
|
||||||
);
|
|
||||||
|
|
||||||
let id = ParaId::from(cli.run.parachain_id);
|
|
||||||
|
|
||||||
let parachain_account =
|
|
||||||
AccountIdConversion::<polkadot_primitives::v0::AccountId>::into_account(&id);
|
|
||||||
|
|
||||||
let block = generate_genesis_state(id)?;
|
|
||||||
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
|
|
||||||
|
|
||||||
runner.run_node_until_exit(|config| {
|
runner.run_node_until_exit(|config| {
|
||||||
polkadot_cli.base_path =
|
// TODO
|
||||||
config.base_path.as_ref().map(|x| x.path().join("polkadot"));
|
let key = Arc::new(sp_core::Pair::generate().0);
|
||||||
|
|
||||||
|
let extension = chain_spec::Extensions::try_get(&config.chain_spec);
|
||||||
|
let relay_chain_id = extension.map(|e| e.relay_chain.clone());
|
||||||
|
let para_id = extension.map(|e| e.para_id);
|
||||||
|
|
||||||
|
let polkadot_cli = RelayChainCli::new(
|
||||||
|
config.base_path.as_ref().map(|x| x.path().join("polkadot")),
|
||||||
|
relay_chain_id,
|
||||||
|
[RelayChainCli::executable_name().to_string()]
|
||||||
|
.iter()
|
||||||
|
.chain(cli.relaychain_args.iter()),
|
||||||
|
);
|
||||||
|
|
||||||
|
let id = ParaId::from(cli.run.parachain_id.or(para_id).unwrap_or(100));
|
||||||
|
|
||||||
|
let parachain_account =
|
||||||
|
AccountIdConversion::<polkadot_primitives::v0::AccountId>::into_account(&id);
|
||||||
|
|
||||||
|
let block =
|
||||||
|
generate_genesis_state(&config.chain_spec).map_err(|e| format!("{:?}", e))?;
|
||||||
|
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
|
||||||
|
|
||||||
let task_executor = config.task_executor.clone();
|
let task_executor = config.task_executor.clone();
|
||||||
let polkadot_config =
|
let polkadot_config =
|
||||||
@@ -227,7 +269,7 @@ pub fn run() -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CliConfiguration for PolkadotCli {
|
impl CliConfiguration for RelayChainCli {
|
||||||
fn shared_params(&self) -> &SharedParams {
|
fn shared_params(&self) -> &SharedParams {
|
||||||
self.base.base.shared_params()
|
self.base.base.shared_params()
|
||||||
}
|
}
|
||||||
@@ -310,6 +352,16 @@ impl CliConfiguration for PolkadotCli {
|
|||||||
unreachable!("PolkadotCli is never initialized; qed");
|
unreachable!("PolkadotCli is never initialized; qed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn chain_id(&self, is_dev: bool) -> Result<String> {
|
||||||
|
let chain_id = self.base.base.chain_id(is_dev)?;
|
||||||
|
|
||||||
|
Ok(if chain_id.is_empty() {
|
||||||
|
self.chain_id.clone().unwrap_or_default()
|
||||||
|
} else {
|
||||||
|
chain_id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn role(&self, is_dev: bool) -> Result<sc_service::Role> {
|
fn role(&self, is_dev: bool) -> Result<sc_service::Role> {
|
||||||
self.base.base.role(is_dev)
|
self.base.base.role(is_dev)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ async fn integration_test() {
|
|||||||
INTEGRATION_TEST_ALLOWED_TIME
|
INTEGRATION_TEST_ALLOWED_TIME
|
||||||
.and_then(|x| x.parse().ok())
|
.and_then(|x| x.parse().ok())
|
||||||
.unwrap_or(600),
|
.unwrap_or(600),
|
||||||
))
|
)).fuse();
|
||||||
.fuse();
|
|
||||||
|
|
||||||
let t2 = async {
|
let t2 = async {
|
||||||
let para_id = ParaId::from(100);
|
let para_id = ParaId::from(100);
|
||||||
@@ -69,7 +68,8 @@ async fn integration_test() {
|
|||||||
future::join(alice.wait_for_blocks(2), bob.wait_for_blocks(2)).await;
|
future::join(alice.wait_for_blocks(2), bob.wait_for_blocks(2)).await;
|
||||||
|
|
||||||
// export genesis state
|
// export genesis state
|
||||||
let genesis_state = crate::command::generate_genesis_state(para_id)
|
let spec = crate::chain_spec::get_chain_spec(para_id);
|
||||||
|
let genesis_state = crate::command::generate_genesis_state(&(Box::new(spec) as Box<_>))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.encode();
|
.encode();
|
||||||
|
|
||||||
|
|||||||
@@ -112,9 +112,6 @@ pub fn run_collator(
|
|||||||
if matches!(parachain_config.role, Role::Light) {
|
if matches!(parachain_config.role, Role::Light) {
|
||||||
return Err("Light client not supported!".into());
|
return Err("Light client not supported!".into());
|
||||||
}
|
}
|
||||||
if matches!(polkadot_config.role, Role::Light) {
|
|
||||||
return Err("Light client not supported!".into());
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut parachain_config = prepare_collator_config(parachain_config);
|
let mut parachain_config = prepare_collator_config(parachain_config);
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,11 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use std::{process::{Child, ExitStatus}, thread, time::Duration};
|
use std::{
|
||||||
|
process::{Child, ExitStatus},
|
||||||
|
thread,
|
||||||
|
time::Duration,
|
||||||
|
};
|
||||||
|
|
||||||
/// Wait for the given `child` the given ammount of `secs`.
|
/// Wait for the given `child` the given ammount of `secs`.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -22,17 +22,18 @@ mod common;
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn polkadot_argument_parsing() {
|
fn polkadot_argument_parsing() {
|
||||||
use nix::sys::signal::{
|
use nix::{
|
||||||
kill,
|
sys::signal::{
|
||||||
Signal::{self, SIGINT, SIGTERM},
|
kill,
|
||||||
|
Signal::{self, SIGINT, SIGTERM},
|
||||||
|
},
|
||||||
|
unistd::Pid,
|
||||||
};
|
};
|
||||||
use nix::unistd::Pid;
|
|
||||||
|
|
||||||
fn run_command_and_kill(signal: Signal) {
|
fn run_command_and_kill(signal: Signal) {
|
||||||
let _ = fs::remove_dir_all("polkadot_argument_parsing");
|
let _ = fs::remove_dir_all("polkadot_argument_parsing");
|
||||||
let mut cmd = Command::new(cargo_bin("cumulus-test-parachain-collator"))
|
let mut cmd = Command::new(cargo_bin("cumulus-test-parachain-collator"))
|
||||||
.args(&[
|
.args(&[
|
||||||
"--dev",
|
|
||||||
"-d",
|
"-d",
|
||||||
"polkadot_argument_parsing",
|
"polkadot_argument_parsing",
|
||||||
"--",
|
"--",
|
||||||
|
|||||||
@@ -15,25 +15,33 @@
|
|||||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use assert_cmd::cargo::cargo_bin;
|
use assert_cmd::cargo::cargo_bin;
|
||||||
use std::{convert::TryInto, process::Command, thread, time::Duration, fs};
|
use std::{convert::TryInto, fs, process::Command, thread, time::Duration};
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn interrupt_polkadot_mdns_issue_test() {
|
fn interrupt_polkadot_mdns_issue_test() {
|
||||||
use nix::sys::signal::{kill, Signal::{self, SIGINT, SIGTERM}};
|
use nix::{
|
||||||
use nix::unistd::Pid;
|
sys::signal::{
|
||||||
|
kill,
|
||||||
|
Signal::{self, SIGINT, SIGTERM},
|
||||||
|
},
|
||||||
|
unistd::Pid,
|
||||||
|
};
|
||||||
|
|
||||||
fn run_command_and_kill(signal: Signal) {
|
fn run_command_and_kill(signal: Signal) {
|
||||||
let _ = fs::remove_dir_all("interrupt_polkadot_mdns_issue_test");
|
let _ = fs::remove_dir_all("interrupt_polkadot_mdns_issue_test");
|
||||||
let mut cmd = Command::new(cargo_bin("cumulus-test-parachain-collator"))
|
let mut cmd = Command::new(cargo_bin("cumulus-test-parachain-collator"))
|
||||||
.args(&["-d", "interrupt_polkadot_mdns_issue_test", "--dev", "--", "--dev"])
|
.args(&["-d", "interrupt_polkadot_mdns_issue_test", "--", "--dev"])
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
thread::sleep(Duration::from_secs(20));
|
thread::sleep(Duration::from_secs(20));
|
||||||
assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running");
|
assert!(
|
||||||
|
cmd.try_wait().unwrap().is_none(),
|
||||||
|
"the process should still be running"
|
||||||
|
);
|
||||||
kill(Pid::from_raw(cmd.id().try_into().unwrap()), signal).unwrap();
|
kill(Pid::from_raw(cmd.id().try_into().unwrap()), signal).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
common::wait_for(&mut cmd, 30).map(|x| x.success()),
|
common::wait_for(&mut cmd, 30).map(|x| x.success()),
|
||||||
|
|||||||
@@ -15,31 +15,38 @@
|
|||||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use assert_cmd::cargo::cargo_bin;
|
use assert_cmd::cargo::cargo_bin;
|
||||||
use std::{convert::TryInto, process::Command, thread, time::Duration, fs, path::PathBuf};
|
use std::{convert::TryInto, fs, path::PathBuf, process::Command, thread, time::Duration};
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn purge_chain_works() {
|
fn purge_chain_works() {
|
||||||
use nix::sys::signal::{kill, Signal::SIGINT};
|
use nix::{
|
||||||
use nix::unistd::Pid;
|
sys::signal::{kill, Signal::SIGINT},
|
||||||
|
unistd::Pid,
|
||||||
|
};
|
||||||
|
|
||||||
let base_path = "purge_chain_test";
|
let base_path = "purge_chain_test";
|
||||||
|
|
||||||
let _ = fs::remove_dir_all(base_path);
|
let _ = fs::remove_dir_all(base_path);
|
||||||
let mut cmd = Command::new(cargo_bin("cumulus-test-parachain-collator"))
|
let mut cmd = Command::new(cargo_bin("cumulus-test-parachain-collator"))
|
||||||
.args(&["-d", base_path, "--dev", "--", "--dev"])
|
.args(&["-d", base_path, "--", "--dev"])
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Let it produce some blocks.
|
// Let it produce some blocks.
|
||||||
thread::sleep(Duration::from_secs(30));
|
thread::sleep(Duration::from_secs(30));
|
||||||
assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running");
|
assert!(
|
||||||
|
cmd.try_wait().unwrap().is_none(),
|
||||||
|
"the process should still be running"
|
||||||
|
);
|
||||||
|
|
||||||
// Stop the process
|
// Stop the process
|
||||||
kill(Pid::from_raw(cmd.id().try_into().unwrap()), SIGINT).unwrap();
|
kill(Pid::from_raw(cmd.id().try_into().unwrap()), SIGINT).unwrap();
|
||||||
assert!(common::wait_for(&mut cmd, 30).map(|x| x.success()).unwrap_or_default());
|
assert!(common::wait_for(&mut cmd, 30)
|
||||||
|
.map(|x| x.success())
|
||||||
|
.unwrap_or_default());
|
||||||
|
|
||||||
let status = Command::new(cargo_bin("cumulus-test-parachain-collator"))
|
let status = Command::new(cargo_bin("cumulus-test-parachain-collator"))
|
||||||
.args(&["purge-chain", "-d", base_path, "-y"])
|
.args(&["purge-chain", "-d", base_path, "-y"])
|
||||||
@@ -48,6 +55,10 @@ fn purge_chain_works() {
|
|||||||
assert!(status.success());
|
assert!(status.success());
|
||||||
|
|
||||||
// Make sure that the `parachain_local_testnet` chain folder exists, but the `db` is deleted.
|
// Make sure that the `parachain_local_testnet` chain folder exists, but the `db` is deleted.
|
||||||
assert!(PathBuf::from(base_path).join("chains/local_testnet/").exists());
|
assert!(PathBuf::from(base_path)
|
||||||
assert!(!PathBuf::from(base_path).join("chains/local_testnet/db").exists());
|
.join("chains/local_testnet/")
|
||||||
|
.exists());
|
||||||
|
assert!(!PathBuf::from(base_path)
|
||||||
|
.join("chains/local_testnet/db")
|
||||||
|
.exists());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,25 +15,33 @@
|
|||||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use assert_cmd::cargo::cargo_bin;
|
use assert_cmd::cargo::cargo_bin;
|
||||||
use std::{convert::TryInto, process::Command, thread, time::Duration, fs};
|
use std::{convert::TryInto, fs, process::Command, thread, time::Duration};
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn running_the_node_works_and_can_be_interrupted() {
|
fn running_the_node_works_and_can_be_interrupted() {
|
||||||
use nix::sys::signal::{kill, Signal::{self, SIGINT, SIGTERM}};
|
use nix::{
|
||||||
use nix::unistd::Pid;
|
sys::signal::{
|
||||||
|
kill,
|
||||||
|
Signal::{self, SIGINT, SIGTERM},
|
||||||
|
},
|
||||||
|
unistd::Pid,
|
||||||
|
};
|
||||||
|
|
||||||
fn run_command_and_kill(signal: Signal) {
|
fn run_command_and_kill(signal: Signal) {
|
||||||
let _ = fs::remove_dir_all("interrupt_test");
|
let _ = fs::remove_dir_all("interrupt_test");
|
||||||
let mut cmd = Command::new(cargo_bin("cumulus-test-parachain-collator"))
|
let mut cmd = Command::new(cargo_bin("cumulus-test-parachain-collator"))
|
||||||
.args(&["--dev", "-d", "interrupt_test", "--", "--dev"])
|
.args(&["-d", "interrupt_test", "--", "--dev"])
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
thread::sleep(Duration::from_secs(30));
|
thread::sleep(Duration::from_secs(30));
|
||||||
assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running");
|
assert!(
|
||||||
|
cmd.try_wait().unwrap().is_none(),
|
||||||
|
"the process should still be running"
|
||||||
|
);
|
||||||
kill(Pid::from_raw(cmd.id().try_into().unwrap()), signal).unwrap();
|
kill(Pid::from_raw(cmd.id().try_into().unwrap()), signal).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
common::wait_for(&mut cmd, 30).map(|x| x.success()),
|
common::wait_for(&mut cmd, 30).map(|x| x.success()),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ build = "build.rs"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
runtime = { package = "cumulus-runtime", path = "../../runtime", default-features = false }
|
runtime = { package = "cumulus-runtime", path = "../../runtime", default-features = false }
|
||||||
substrate-test-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "cumulus-branch", version = "2.0.0-rc5" }
|
substrate-test-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-branch", version = "2.0.0-rc5" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = " 1.0.6" }
|
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = " 1.0.6" }
|
||||||
|
|||||||
@@ -6,16 +6,17 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Substrate dependencies
|
# Substrate dependencies
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "cumulus-branch", default-features = false }
|
sp-std = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", default-features = false }
|
||||||
|
|
||||||
# Polkadot deps
|
# Polkadot deps
|
||||||
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch", default-features = false }
|
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false }
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch", default-features = false }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false }
|
||||||
|
|
||||||
# All these should be optional dependenices, but given the perfect Cargo, it is not possible.
|
# All these should be optional dependenices, but given the perfect Cargo, it is not possible.
|
||||||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch", default-features = false }
|
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false }
|
||||||
kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch", default-features = false }
|
kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false }
|
||||||
westend-runtime = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch", default-features = false }
|
westend-runtime = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false }
|
||||||
|
rococo-runtime = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [ "std" ]
|
default = [ "std" ]
|
||||||
@@ -24,6 +25,7 @@ std = [
|
|||||||
"polkadot-runtime/std",
|
"polkadot-runtime/std",
|
||||||
"kusama-runtime/std",
|
"kusama-runtime/std",
|
||||||
"westend-runtime/std",
|
"westend-runtime/std",
|
||||||
|
"rococo-runtime/std",
|
||||||
"polkadot-core-primitives/std",
|
"polkadot-core-primitives/std",
|
||||||
"polkadot-parachain/std",
|
"polkadot-parachain/std",
|
||||||
]
|
]
|
||||||
@@ -35,5 +37,6 @@ std = [
|
|||||||
runtime-wasm = [
|
runtime-wasm = [
|
||||||
"polkadot-runtime/disable-runtime-api",
|
"polkadot-runtime/disable-runtime-api",
|
||||||
"westend-runtime/disable-runtime-api",
|
"westend-runtime/disable-runtime-api",
|
||||||
|
"rococo-runtime/disable-runtime-api",
|
||||||
"kusama-runtime/disable-runtime-api",
|
"kusama-runtime/disable-runtime-api",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
//! Kusama upward message
|
//! Kusama upward message
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use polkadot_core_primitives::{Balance, AccountId};
|
|
||||||
use kusama_runtime::{BalancesCall, ParachainsCall};
|
use kusama_runtime::{BalancesCall, ParachainsCall};
|
||||||
|
use polkadot_core_primitives::{AccountId, Balance};
|
||||||
use sp_std::vec::Vec;
|
use sp_std::vec::Vec;
|
||||||
|
|
||||||
/// The Kusama upward message.
|
/// The Kusama upward message.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Upward messages types and traits for Polkadot, Kusama and Westend.
|
//! Upward messages types and traits for Polkadot, Kusama, Rococo and Westend.
|
||||||
//!
|
//!
|
||||||
//! As Cumulus needs to suits multiple Polkadot-like runtimes the upward message
|
//! As Cumulus needs to suits multiple Polkadot-like runtimes the upward message
|
||||||
//! type is different for each of them. To support all of them, Cumulus provides
|
//! type is different for each of them. To support all of them, Cumulus provides
|
||||||
@@ -25,12 +25,14 @@
|
|||||||
use polkadot_parachain::primitives::Id as ParaId;
|
use polkadot_parachain::primitives::Id as ParaId;
|
||||||
use sp_std::vec::Vec;
|
use sp_std::vec::Vec;
|
||||||
|
|
||||||
mod polkadot;
|
|
||||||
mod kusama;
|
mod kusama;
|
||||||
|
mod polkadot;
|
||||||
|
mod rococo;
|
||||||
mod westend;
|
mod westend;
|
||||||
|
|
||||||
pub use polkadot::UpwardMessage as PolkadotUpwardMessage;
|
|
||||||
pub use kusama::UpwardMessage as KusamaUpwardMessage;
|
pub use kusama::UpwardMessage as KusamaUpwardMessage;
|
||||||
|
pub use polkadot::UpwardMessage as PolkadotUpwardMessage;
|
||||||
|
pub use rococo::UpwardMessage as RococoUpwardMessage;
|
||||||
pub use westend::UpwardMessage as WestendUpwardMessage;
|
pub use westend::UpwardMessage as WestendUpwardMessage;
|
||||||
|
|
||||||
/// A `Balances` related upward message.
|
/// A `Balances` related upward message.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
//! Polkadot upward message
|
//! Polkadot upward message
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use polkadot_core_primitives::{Balance, AccountId};
|
use polkadot_core_primitives::{AccountId, Balance};
|
||||||
use polkadot_runtime::{BalancesCall, ParachainsCall};
|
use polkadot_runtime::{BalancesCall, ParachainsCall};
|
||||||
use sp_std::vec::Vec;
|
use sp_std::vec::Vec;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
// Copyright 2020 Parity Technologies (UK) Ltd.
|
||||||
|
// This file is part of Cumulus.
|
||||||
|
|
||||||
|
// Substrate is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Substrate is distributed in the hope that it will be useful,
|
||||||
|
// 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/>.
|
||||||
|
|
||||||
|
//! Rococo upward message
|
||||||
|
|
||||||
|
use crate::*;
|
||||||
|
use polkadot_core_primitives::{AccountId, Balance};
|
||||||
|
use rococo_runtime::{BalancesCall, ParachainsCall};
|
||||||
|
use sp_std::vec::Vec;
|
||||||
|
|
||||||
|
/// The Rococo upward message.
|
||||||
|
pub type UpwardMessage = rococo_runtime::Call;
|
||||||
|
|
||||||
|
impl BalancesMessage<AccountId, Balance> for UpwardMessage {
|
||||||
|
fn transfer(dest: AccountId, amount: Balance) -> Self {
|
||||||
|
BalancesCall::transfer(dest, amount).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl XCMPMessage for UpwardMessage {
|
||||||
|
fn send_message(dest: ParaId, msg: Vec<u8>) -> Self {
|
||||||
|
ParachainsCall::send_xcmp_message(dest, msg).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,9 +17,9 @@
|
|||||||
//! Westend upward message
|
//! Westend upward message
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use polkadot_core_primitives::{Balance, AccountId};
|
use polkadot_core_primitives::{AccountId, Balance};
|
||||||
use westend_runtime::{BalancesCall, ParachainsCall};
|
|
||||||
use sp_std::vec::Vec;
|
use sp_std::vec::Vec;
|
||||||
|
use westend_runtime::{BalancesCall, ParachainsCall};
|
||||||
|
|
||||||
/// The Westend upward message.
|
/// The Westend upward message.
|
||||||
pub type UpwardMessage = westend_runtime::Call;
|
pub type UpwardMessage = westend_runtime::Call;
|
||||||
|
|||||||
Reference in New Issue
Block a user