Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add test parachain #22

Merged
merged 11 commits into from
Nov 6, 2019
2,452 changes: 2,180 additions & 272 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[workspace]
members = [
"consensus",
"runtime",
"test/runtime",
"test/client",
"consensus",
"runtime",
"test/runtime",
"test/client",
"test/parachain/runtime",
"test/parachain/",
]

[profile.release]
panic = 'unwind'
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,51 @@ Cumulus clouds are shaped sort of like dots and are up in the air, like this pro

For now, this is only project contained in this repo. *cumulus-consensus* is a consensus engine for Substrate which follows a Polkadot relay chain. This will run a Polkadot node internally, and dictate to the client and synchronization algorithms which chain to follow, finalize, and treat as best.

## cumulus-runtime
## cumulus-runtime

A planned wrapper around substrate runtimes to turn them into parachain validation code and to provide proof-generation routines.

## cumulus-collator

A planned Polkadot collator for the parachain.
A planned Polkadot collator for the parachain.

## Running a collator

1. Checkout polkadot at `bkchr-cumulus-branch`.
2. Build the polkadot chainspec:

`cargo run --release -- build-spec --chain=local --raw > polkadot_chainspec.json`

Open the `polkadot_chainspec.json` and replace the `bootnodes` with: `"bootNodes": [],`

3. Run `Alice` and `Bob`:

`cargo run --release -- --chain=local --base-path=cumulus_relay_chain_node_0 --alice`

`cargo run --release -- --chain=local --base-path=cumulus_relay_chain_node_1 --bob --port 50666`

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 -- -d cumulus_collator_path --chain polkadot_chainspec.json --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/PEER_ID`

`PEER_ID` needs to be replaced with the peer id of the polkadot validator that uses `Alice`
as authority.

5. Open `https://polkadot.js.org/apps/#/sudo` and register the parachain.

`id`: `100`

`initial_head_data`: Use the file you generated in 3. (name: genesis-state)

`code`: `CUMULUS_REPO/target/release/wbuild/cumulus-test-parachain-runtime/cumulus_test_parachain_runtime.compact.wasm`

Now your parachain should be registered and the collator should start building blocks and sending
them to the relay chain.

6. ...

7. PROFIT!
11 changes: 11 additions & 0 deletions collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ edition = "2018"
[dependencies]
# Substrate dependencies
sr-primitives = { package = "sr-primitives", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
substrate-service = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
consensus-common = { package = "substrate-consensus-common", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
inherents = { package = "substrate-inherents", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
cli = { package = "substrate-cli", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
Expand All @@ -15,6 +18,10 @@ cli = { package = "substrate-cli", git = "https://github.com/paritytech/substrat
polkadot-collator = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-cumulus-branch" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-cumulus-branch" }

# Cumulus dependencies
cumulus-consensus = { path = "../consensus" }
cumulus-runtime = { path = "../runtime" }

# other deps
log = "0.4.8"
codec = { package = "parity-scale-codec", version = "1.0.6", features = [ "derive" ] }
Expand All @@ -24,4 +31,8 @@ parking_lot = "0.9"

[dev-dependencies]
test-runtime = { package = "cumulus-test-runtime", path = "../test/runtime" }
test-client = { package = "cumulus-test-client", path = "../test/client" }
substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
polkadot-executor = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-cumulus-branch" }
keyring = { package = "substrate-keyring", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
env_logger = "0.7.1"
Loading