Skip to content

Commit

Permalink
Cumulus updates and new content (#589)
Browse files Browse the repository at this point in the history
update to OSPL
fix github #586
expose htg on conversion to parachain in navbar
expose rococo registration in navbar
Co-authored-by: Sacha Lansky <sacha@parity.io>
  • Loading branch information
nuke-web3 authored Nov 23, 2021
1 parent 2236767 commit b0f2d74
Show file tree
Hide file tree
Showing 7 changed files with 376 additions and 424 deletions.
1 change: 1 addition & 0 deletions i18n/react-intl/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
"htg-consensus-hybrid": "Create a PoS-PoW Hybrid Node",

"docs-nav-htg-parachains": "Parachains",
"htg-parachains-convert": "Solochain Logic Conversion",
"htg-parachains-connect": "Connect to a Relay Chain",
"htg-parachains-collators": "Collator Selection",
"htg-parachains-pre-launch": "Pre-Launch Requirements",
Expand Down
16 changes: 10 additions & 6 deletions src/components/DevNavMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,10 @@ const DevNavMenu = {
id: 'docs-nav-htg-parachains',
})}`,
items: [
{
title: `${intl.formatMessage({ id: 'htg-parachains-convert' })}`,
link: '/how-to-guides/v3/parachains/convert',
},
{
title: `${intl.formatMessage({ id: 'htg-parachains-connect' })}`,
link: '/how-to-guides/v3/parachains/connect/',
Expand Down Expand Up @@ -682,21 +686,21 @@ DevNavMenuTuts.set('cumulusTutorial', [
name: `Cumulus Tutorial`,
items: [
{
title: `Start a Relay Chain`,
title: `Start a Local Relay Chain`,
link: '/tutorials/v3/cumulus/start-relay/',
},
{
title: `Connect a Parachain`,
link: '/tutorials/v3/cumulus/connect-parachain/',
},
{
title: `Launch a Parachain Testnet`,
title: `Launch a Local Parachain Testnet`,
link: '/tutorials/v3/cumulus/polkadot-launch/',
},
// {
// title: `Register on Rococo`,
// link: '/tutorials/v3/cumulus/rococo',
// },
{
title: `Connect to a Live Relay Chain`,
link: '/tutorials/v3/cumulus/rococo',
},
],
},
])
Expand Down
82 changes: 44 additions & 38 deletions v3/how-to-guides/07-parachains/a-solo-to-parachain/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@ version: polkadot-0.9.11
section: how to guides
category: parachains
difficulty: 2
keywords: collator, parachain, parathread, upgrade, cumulus, storage, migration, paraid, register, launch
keywords:
- collator
- parachain
- parathread
- upgrade
- cumulus
- storage
- migration
- paraid
- register
- launch
- convert
---

<Objectives
Expand All @@ -17,17 +28,17 @@ keywords: collator, parachain, parathread, upgrade, cumulus, storage, migration,
{
title: 'Use Cases',
description: `
- Bootstraping a solo-chain's security
- Access XCMP with Parachains on a common relay chain
- Bootstraping a solo-chain's security
- Access XCMP with Parachains on a common relay chain
`,
},
{
title: 'Overview',
description: `
Integration of Cumulus for any Substrate chain enables this chain to couple it's _finality_ with a
realy chain, like Polkadot. This guide does _not_ inform on how to migrate a _running solo-chain_,
only the steps required to convert the _codebase_ of a node to use Cumulus for consensus instead
of somehting like GRANDPA that is common for other Substrate solo-chains.
Integration of Cumulus for any Substrate chain enables this chain to couple it's _finality_ with a
relay chain, like Polkadot. This guide does _not_ inform on how to migrate a _running solo-chain_,
only the steps required to convert the _codebase_ of a node to use Cumulus for consensus instead
of something like GRANDPA that is common for other Substrate solo-chains.
`,
},
]}
Expand All @@ -38,41 +49,37 @@ keywords: collator, parachain, parathread, upgrade, cumulus, storage, migration,

<Message
type={`yellow`}
title={`WORK IN PROGRESS - NOT COMPLETE!`}
text={`This is an _overview_, not a proper how to guide presently!`}
title={`DOC WORK IN PROGRESS`}
text={`
This is an _overview_, not a proper how-to guide presently!
`}
/>

## Parachain node template overview

Substrate developers who are familiar with the Substrate Node Template will find the Substrate
Parachain Template familiar. They have the same general structure featuring `node`, `runtime`, and
`pallets` directories. Their runtimes are similar and feature many of the same pallets. Apart from
a few new traits, the `pallet-template` itself is essentially identical. Many of the
[tutorials](/tutorials/v3) can be used with few modifications on the Parachain Template.
Substrate developers who are familiar with the Substrate Node Template will find the Substrate Parachain Template familiar.
They have the same general structure featuring `node`, `runtime`, and `pallets` directories.
Their runtimes are similar and feature many of the same pallets. Apart from a few new traits, the `pallet-template` itself is essentially identical.
Many of the [tutorials](/tutorials/v3) can be used with few modifications on the Parachain Template.

The similarities between these two templates should give you confidence that if you've built a
Substrate chain, you will have no problem building a parachain!
The similarities between these two templates should give you confidence that if you've built a Substrate chain, you will have no problem building a parachain!

### Differences from the node template

There are, however, a few important differences between the two templates that are worth observing at
the outset.
There are, however, a few important differences between the two templates that are worth observing at the outset.

#### Parachain info pallet

Parachain Template runtime ([`runtime/Cargo.toml`](https://github.com/substrate-developer-hub/substrate-parachain-template/blob/latest/runtime/Cargo.toml))
has integrated [`parachain-info` pallet](https://paritytech.github.io/cumulus/parachain_info/pallet/index.html) in.
This pallet is designed to inject information about the parachain's registration into its own
runtime. Currently it just injects the para ID that the chain is registered at. This allows the
runtime to know which cross-chain messages are intended for it.
Parachain Template runtime ([`runtime/Cargo.toml`](https://github.com/substrate-developer-hub/substrate-parachain-template/blob/latest/runtime/Cargo.toml)) has integrated [`parachain-info` pallet](https://paritytech.github.io/cumulus/parachain_info/pallet/index.html) in.
This pallet is designed to inject information about the parachain's registration into its own runtime.
Currently it just injects the para ID that the chain is registered at.
This allows the runtime to know which cross-chain messages are intended for it.

#### `register_validate_block!` macro

Each parachain must supply a `validate_block` function, expressed as a Wasm blob, to the relay chain
when registering. The Node Template does not provide this function, but the parachain template does,
Thanks to cumulus, creating this function for a Substrate runtime is as simple as adding one line of
code as shown
[at the bottom of the runtime](https://github.com/substrate-developer-hub/substrate-parachain-template/blob/latest/runtime/src/lib.rs#L648-L652):
Each parachain must supply a `validate_block` function, expressed as a Wasm blob, to the relay chain when registering.
The Node Template does not provide this function, but the parachain template does,
Thanks to cumulus, creating this function for a Substrate runtime is as simple as adding one line of code as shown [at the bottom of the runtime](https://github.com/substrate-developer-hub/substrate-parachain-template/blob/latest/runtime/src/lib.rs#L648-L652):

```rust
cumulus_pallet_parachain_system::register_validate_block!(
Expand All @@ -84,23 +91,22 @@ cumulus_pallet_parachain_system::register_validate_block!(

#### No `GRANDPA` pallet

Many popular Substrate runtimes including the Node Template features a finality-related GRANDPA
pallet and its associated `GrandpaApi`. These are both missing from the Parachain Template.
Many popular Substrate runtimes including the Node Template features a finality-related GRANDPA pallet and its associated `GrandpaApi`.
These are both missing from the Parachain Template.

This is because parachains follow the finality of the relay chain rather than running their own
finality gadget. This is fundamental to Polkadot's architecture and will not change.
This is because parachains follow the finality of the relay chain rather than running their own finality gadget.
This is fundamental to Polkadot's architecture and will not change.

#### Service

The collator service
([`node/src/service.rs`](https://github.com/substrate-developer-hub/substrate-parachain-template/blob/latest/node/src/service.rs))
is entirely different from the one of Node template. While you can find similarities, the structure
of the service is much different. This new service is the primary change that cumulus provides.
The collator service ([`node/src/service.rs`](https://github.com/substrate-developer-hub/substrate-parachain-template/blob/latest/node/src/service.rs)) is entirely different from the one of Node template.
While you can find similarities, the structure of the service is much different.
This new service is the primary change that cumulus provides.

<Message
type={`gray`}
title={`Note`}
text={`When modifying an existing Substrate chain to use Cumulus, it is generally best to copy the
service code from the Parachain Template.
text={`
When modifying an existing Substrate chain to use Cumulus, it is generally best to copy the service code from the Parachain Template.
`}
/>
Loading

0 comments on commit b0f2d74

Please sign in to comment.