Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Don't merge] Update the parachain template to 1.14.0 #7

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15,323 changes: 0 additions & 15,323 deletions Cargo.lock

This file was deleted.

50 changes: 50 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,56 @@ members = [
resolver = "2"

[workspace.dependencies]
clap = { version = "4.5.3" }
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
color-print = { version = "0.3.4" }
cumulus-client-cli = { path = "cumulus/client/cli", default-features = false, version = "0.15.0" }
cumulus-client-collator = { path = "cumulus/client/collator", default-features = false, version = "0.15.0" }
cumulus-client-consensus-aura = { path = "cumulus/client/consensus/aura", default-features = false, version = "0.15.0" }
cumulus-client-consensus-common = { path = "cumulus/client/consensus/common", default-features = false, version = "0.15.0" }
cumulus-client-consensus-proposer = { path = "cumulus/client/consensus/proposer", default-features = false, version = "0.14.0" }
cumulus-client-service = { path = "cumulus/client/service", default-features = false, version = "0.15.0" }
cumulus-primitives-core = { path = "cumulus/primitives/core", default-features = false, version = "0.14.0" }
cumulus-primitives-parachain-inherent = { path = "cumulus/primitives/parachain-inherent", default-features = false, version = "0.14.0" }
cumulus-relay-chain-interface = { path = "cumulus/client/relay-chain-interface", default-features = false, version = "0.15.0" }
docify = { version = "0.2.8" }
frame-benchmarking = { path = "substrate/frame/benchmarking", default-features = false, version = "36.0.0" }
frame-benchmarking-cli = { path = "substrate/utils/frame/benchmarking-cli", default-features = false, version = "40.0.0" }
futures = { version = "0.3.30" }
jsonrpsee = { version = "0.23.2" }
log = { version = "0.4.21", default-features = false }
pallet-transaction-payment-rpc = { path = "substrate/frame/transaction-payment/rpc", default-features = false, version = "38.0.0" }
parachain-template-runtime = { path = "templates/parachain/runtime", version = "0.1.0" }
polkadot-cli = { path = "polkadot/cli", default-features = false, version = "15.0.0" }
polkadot-primitives = { path = "polkadot/primitives", default-features = false, version = "14.0.0" }
prometheus-endpoint = { path = "substrate/utils/prometheus", default-features = false, package = "substrate-prometheus-endpoint", version = "0.17.0" }
sc-basic-authorship = { path = "substrate/client/basic-authorship", default-features = false, version = "0.42.0" }
sc-chain-spec = { path = "substrate/client/chain-spec", default-features = false, version = "35.0.0" }
sc-cli = { path = "substrate/client/cli", default-features = false, version = "0.44.0" }
sc-client-api = { path = "substrate/client/api", default-features = false, version = "35.1.0" }
sc-consensus = { path = "substrate/client/consensus/common", default-features = false, version = "0.41.0" }
sc-executor = { path = "substrate/client/executor", default-features = false, version = "0.39.0" }
sc-network = { path = "substrate/client/network", default-features = false, version = "0.42.0" }
sc-network-sync = { path = "substrate/client/network/sync", default-features = false, version = "0.41.0" }
sc-offchain = { path = "substrate/client/offchain", default-features = false, version = "37.0.0" }
sc-rpc = { path = "substrate/client/rpc", default-features = false, version = "37.0.0" }
sc-service = { path = "substrate/client/service", default-features = false, version = "0.43.0" }
sc-sysinfo = { path = "substrate/client/sysinfo", default-features = false, version = "35.0.0" }
sc-telemetry = { path = "substrate/client/telemetry", default-features = false, version = "22.0.0" }
sc-tracing = { path = "substrate/client/tracing", default-features = false, version = "35.0.0" }
sc-transaction-pool = { path = "substrate/client/transaction-pool", default-features = false, version = "35.0.0" }
sc-transaction-pool-api = { path = "substrate/client/transaction-pool/api", default-features = false, version = "35.0.0" }
serde = { version = "1.0.197", default-features = false }
serde_json = { version = "1.0.114", default-features = false }
sp-api = { path = "substrate/primitives/api", default-features = false, version = "33.0.0" }
sp-block-builder = { path = "substrate/primitives/block-builder", default-features = false, version = "33.0.0" }
sp-blockchain = { path = "substrate/primitives/blockchain", default-features = false, version = "35.1.0" }
sp-consensus-aura = { path = "substrate/primitives/consensus/aura", default-features = false, version = "0.39.0" }
sp-core = { path = "substrate/primitives/core", default-features = false, version = "34.0.0" }
sp-io = { path = "substrate/primitives/io", default-features = false, version = "37.0.0" }
sp-keystore = { path = "substrate/primitives/keystore", default-features = false, version = "0.40.0" }
sp-runtime = { path = "substrate/primitives/runtime", default-features = false, version = "38.0.0" }
sp-timestamp = { path = "substrate/primitives/timestamp", default-features = false, version = "33.0.0" }
substrate-frame-rpc-system = { path = "substrate/utils/frame/rpc/system", default-features = false, version = "36.0.0" }
xcm = { path = "polkadot/xcm", default-features = false, package = "staging-xcm", version = "14.0.1" }
substrate-build-script-utils = { path = "substrate/utils/build-script-utils", default-features = false, version = "11.0.0" }
131 changes: 115 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,121 @@
# Substrate Cumulus Parachain Template
<div align="center">

A new [Cumulus](https://github.com/paritytech/polkadot-sdk/tree/master/cumulus)-based Substrate node, ready for hacking ☁️..
# Polkadot SDK's Parachain Template

This project is originally a fork of the
[Substrate Node Template](https://github.com/substrate-developer-hub/substrate-node-template)
modified to include dependencies required for registering this node as a **parathread** or
**parachain** to a **relay chain**.
<img height="70px" alt="Polkadot SDK Logo" src="https://github.com/paritytech/polkadot-sdk/raw/master/docs/images/Polkadot_Logo_Horizontal_Pink_White.png#gh-dark-mode-only"/>
<img height="70px" alt="Polkadot SDK Logo" src="https://github.com/paritytech/polkadot-sdk/raw/master/docs/images/Polkadot_Logo_Horizontal_Pink_Black.png#gh-light-mode-only"/>

The stand-alone version of this template is hosted on the
[Substrate Devhub Parachain Template](https://github.com/substrate-developer-hub/substrate-parachain-template/)
for each release of Polkadot. It is generated directly to the upstream
[Parachain Template in Cumulus](https://github.com/paritytech/polkadot-sdk/tree/master/cumulus/parachain-template)
at each release branch using the
[Substrate Template Generator](https://github.com/paritytech/substrate-template-generator/).
> This is a template for creating a [parachain](https://wiki.polkadot.network/docs/learn-parachains) based on Polkadot SDK.
>
> This template is automatically updated after releases in the main [Polkadot SDK monorepo](https://github.com/paritytech/polkadot-sdk).

👉 Learn more about parachains [here](https://wiki.polkadot.network/docs/learn-parachains), and
parathreads [here](https://wiki.polkadot.network/docs/learn-parathreads).
</div>

* ⏫ This template provides a starting point to build a [parachain](https://wiki.polkadot.network/docs/learn-parachains).

🧙 Learn about how to use this template and run your own parachain testnet for it in the
[Devhub Cumulus Tutorial](https://docs.substrate.io/tutorials/v3/cumulus/start-relay/).
* ☁️ It is based on the
[Cumulus](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/polkadot_sdk/cumulus/index.html) framework.

* 🔧 Its runtime is configured of a single custom pallet as a starting point, and a handful of ready-made pallets
such as a [Balances pallet](https://paritytech.github.io/polkadot-sdk/master/pallet_balances/index.html).

* 👉 Learn more about parachains [here](https://wiki.polkadot.network/docs/learn-parachains)

## Template Structure

A Polkadot SDK based project such as this one consists of:

* 💿 a [Node](./node/README.md) - the binary application.
* 🧮 the [Runtime](./runtime/README.md) - the core logic of the parachain.
* 🎨 the [Pallets](./pallets/README.md) - from which the runtime is constructed.

## Getting Started

* 🦀 The template is using the Rust language.

* 👉 Check the
[Rust installation instructions](https://www.rust-lang.org/tools/install) for your system.

* 🛠️ Depending on your operating system and Rust version, there might be additional
packages required to compile this template - please take note of the Rust compiler output.

### Build

🔨 Use the following command to build the node without launching it:

```sh
cargo build --release
```

🐳 Alternatively, build the docker image:

```sh
docker build . -t polkadot-sdk-parachain-template
```

### Local Development Chain

🧟 This project uses [Zombienet](https://github.com/paritytech/zombienet) to orchestrate the relaychain and parachain nodes.
You can grab a [released binary](https://github.com/paritytech/zombienet/releases/latest) or use an [npm version](https://www.npmjs.com/package/@zombienet/cli).

This template produces a parachain node.
You still need a relaychain node - you can download the `polkadot`
(and the accompanying `polkadot-prepare-worker` and `polkadot-execute-worker`)
binaries from [Polkadot SDK releases](https://github.com/paritytech/polkadot-sdk/releases/latest).

Make sure to bring the parachain node - as well as `polkadot`, `polkadot-prepare-worker`, `polkadot-execute-worker`,
and `zombienet` - into `PATH` like so:

```sh
export PATH="./target/release/:$PATH"
```

This way, we can conveniently use them un the following steps.

👥 The following command starts a local development chain, with a single relay chain node and a single parachain collator:

```sh
zombienet --provider native spawn ./zombienet.toml

# Alternatively, the npm version:
npx --yes @zombienet/cli --provider native spawn ./zombienet.toml
```

Development chains:

* 🧹 Do not persist the state.
* 💰 Are preconfigured with a genesis state that includes several prefunded development accounts.
* 🧑‍⚖️ Development accounts are used as validators, collators, and `sudo` accounts.

### Connect with the Polkadot-JS Apps Front-End

* 🌐 You can interact with your local node using the
hosted version of the Polkadot/Substrate Portal:
[relay chain](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9944)
and [parachain](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9988).

* 🪐 A hosted version is also
available on [IPFS](https://dotapps.io/).

* 🧑‍🔧 You can also find the source code and instructions for hosting your own instance in the
[`polkadot-js/apps`](https://github.com/polkadot-js/apps) repository.

## Contributing

* 🔄 This template is automatically updated after releases in the main [Polkadot SDK monorepo](https://github.com/paritytech/polkadot-sdk).

* ➡️ Any pull requests should be directed to this [source](https://github.com/paritytech/polkadot-sdk/tree/master/templates/parachain).

* 😇 Please refer to the monorepo's
[contribution guidelines](https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md) and
[Code of Conduct](https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CODE_OF_CONDUCT.md).

## Getting Help

* 🧑‍🏫 To learn about Polkadot in general, [Polkadot.network](https://polkadot.network/) website is a good starting point.

* 🧑‍🔧 For technical introduction, [here](https://github.com/paritytech/polkadot-sdk#-documentation) are
the Polkadot SDK documentation resources.

* 👥 Additionally, there are [GitHub issues](https://github.com/paritytech/polkadot-sdk/issues) and
[Substrate StackExchange](https://substrate.stackexchange.com/).
105 changes: 52 additions & 53 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "parachain-template-node"
description = "A parachain node template built with Substrate and Cumulus, part of Polkadot Sdk. (polkadot v1.13.0)"
description = "A parachain node template built with Substrate and Cumulus, part of Polkadot Sdk. (polkadot v1.14.0)"
version = "0.1.0"
license = "Unlicense"
authors.workspace = true
Expand All @@ -14,63 +14,62 @@ build = "build.rs"
# name = "parachain-template-node"

[dependencies]
clap = { version = "4.5.3", features = ["derive"] }
clap = { features = ["derive"], workspace = true }
log = { workspace = true, default-features = true }
codec = { package = "parity-scale-codec", version = "3.6.12" }
codec = { workspace = true, default-features = true }
serde = { features = ["derive"], workspace = true, default-features = true }
jsonrpsee = { version = "0.22", features = ["server"] }
futures = "0.3.28"
jsonrpsee = { features = ["server"], workspace = true }
futures = { workspace = true }
serde_json = { workspace = true, default-features = true }
docify = "0.2.8"
parachain-template-runtime = { version = "0.1.0", path = "../runtime" }
frame-benchmarking = { version = "35.0.0" }
frame-benchmarking-cli = { version = "39.0.0" }
pallet-transaction-payment-rpc = { version = "37.0.0" }
sc-basic-authorship = { version = "0.41.0" }
sc-chain-spec = { version = "34.0.0" }
sc-cli = { version = "0.43.0" }
sc-client-api = { version = "35.0.0" }
sc-offchain = { version = "36.0.0" }
sc-consensus = { version = "0.40.0" }
sc-executor = { version = "0.39.0" }
sc-network = { version = "0.41.0" }
sc-network-sync = { version = "0.40.0" }
sc-rpc = { version = "36.0.0" }
sc-service = { version = "0.42.0" }
sc-sysinfo = { version = "34.0.0" }
sc-telemetry = { version = "21.0.0" }
sc-tracing = { version = "35.0.0" }
sc-transaction-pool = { version = "35.0.0" }
sc-transaction-pool-api = { version = "35.0.0" }
sp-api = { version = "33.0.0" }
sp-block-builder = { version = "33.0.0" }
sp-blockchain = { version = "35.0.0" }
sp-consensus-aura = { version = "0.39.0" }
sp-core = { version = "34.0.0" }
sp-keystore = { version = "0.40.0" }
sp-io = { version = "37.0.0" }
sp-runtime = { version = "38.0.0" }
sp-timestamp = { version = "33.0.0" }
substrate-frame-rpc-system = { version = "35.0.0" }
prometheus-endpoint = { version = "0.17.0", package = "substrate-prometheus-endpoint" }

# Polkadot
polkadot-cli = { version = "14.0.0", features = ["rococo-native"] }
polkadot-primitives = { version = "14.0.0" }
xcm = { version = "14.0.0", package = "staging-xcm", default-features = false }
cumulus-client-cli = { version = "0.14.0" }
cumulus-client-collator = { version = "0.14.0" }
cumulus-client-consensus-aura = { version = "0.14.0" }
cumulus-client-consensus-common = { version = "0.14.0" }
cumulus-client-consensus-proposer = { version = "0.14.0" }
cumulus-client-service = { version = "0.14.0" }
cumulus-primitives-core = { version = "0.14.0" }
cumulus-primitives-parachain-inherent = { version = "0.14.0" }
cumulus-relay-chain-interface = { version = "0.14.0" }
color-print = "0.3.4"
docify = { workspace = true }
parachain-template-runtime = { version = "0.1.0", workspace = true }
frame-benchmarking = { version = "36.0.0", workspace = true, default-features = true }
frame-benchmarking-cli = { version = "40.0.0", workspace = true, default-features = true }
pallet-transaction-payment-rpc = { version = "38.0.0", workspace = true, default-features = true }
sc-basic-authorship = { version = "0.42.0", workspace = true, default-features = true }
sc-chain-spec = { version = "35.0.0", workspace = true, default-features = true }
sc-cli = { version = "0.44.0", workspace = true, default-features = true }
sc-client-api = { version = "35.1.0", workspace = true, default-features = true }
sc-offchain = { version = "37.0.0", workspace = true, default-features = true }
sc-consensus = { version = "0.41.0", workspace = true, default-features = true }
sc-executor = { version = "0.39.0", workspace = true, default-features = true }
sc-network = { version = "0.42.0", workspace = true, default-features = true }
sc-network-sync = { version = "0.41.0", workspace = true, default-features = true }
sc-rpc = { version = "37.0.0", workspace = true, default-features = true }
sc-service = { version = "0.43.0", workspace = true, default-features = true }
sc-sysinfo = { version = "35.0.0", workspace = true, default-features = true }
sc-telemetry = { version = "22.0.0", workspace = true, default-features = true }
sc-tracing = { version = "35.0.0", workspace = true, default-features = true }
sc-transaction-pool = { version = "35.0.0", workspace = true, default-features = true }
sc-transaction-pool-api = { version = "35.0.0", workspace = true, default-features = true }
sp-api = { version = "33.0.0", workspace = true, default-features = true }
sp-block-builder = { version = "33.0.0", workspace = true, default-features = true }
sp-blockchain = { version = "35.1.0", workspace = true, default-features = true }
sp-consensus-aura = { version = "0.39.0", workspace = true, default-features = true }
sp-core = { version = "34.0.0", workspace = true, default-features = true }
sp-keystore = { version = "0.40.0", workspace = true, default-features = true }
sp-io = { version = "37.0.0", workspace = true, default-features = true }
sp-runtime = { version = "38.0.0", workspace = true, default-features = true }
sp-timestamp = { version = "33.0.0", workspace = true, default-features = true }
substrate-frame-rpc-system = { version = "36.0.0", workspace = true, default-features = true }
prometheus-endpoint.workspace = true
prometheus-endpoint.default-features = true
polkadot-cli = { version = "15.0.0", features = ["rococo-native"], workspace = true, default-features = true }
polkadot-primitives = { version = "14.0.0", workspace = true, default-features = true }
xcm.workspace = true
cumulus-client-cli = { version = "0.15.0", workspace = true, default-features = true }
cumulus-client-collator = { version = "0.15.0", workspace = true, default-features = true }
cumulus-client-consensus-aura = { version = "0.15.0", workspace = true, default-features = true }
cumulus-client-consensus-common = { version = "0.15.0", workspace = true, default-features = true }
cumulus-client-consensus-proposer = { version = "0.14.0", workspace = true, default-features = true }
cumulus-client-service = { version = "0.15.0", workspace = true, default-features = true }
cumulus-primitives-core = { version = "0.14.0", workspace = true, default-features = true }
cumulus-primitives-parachain-inherent = { version = "0.14.0", workspace = true, default-features = true }
cumulus-relay-chain-interface = { version = "0.15.0", workspace = true, default-features = true }
color-print = { workspace = true }

[build-dependencies]
substrate-build-script-utils = { version = "11.0.0" }
substrate-build-script-utils = { version = "11.0.0", workspace = true, default-features = true }

[features]
default = []
Expand Down
18 changes: 18 additions & 0 deletions node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Node

ℹ️ A node - in Polkadot - is a binary executable, whose primary purpose is to execute the [runtime](../runtime/README.md).

🔗 It communicates with other nodes in the network, and aims for
[consensus](https://wiki.polkadot.network/docs/learn-consensus) among them.

⚙️ It acts as a remote procedure call (RPC) server, allowing interaction with the blockchain.

👉 Learn more about the architecture, and a difference between a node and a runtime
[here](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/wasm_meta_protocol/index.html).

👇 Here are the most important files in this node template:

- [`chain_spec.rs`](./src/chain_spec.rs): A chain specification is a source code file that defines the chain's
initial (genesis) state.
- [`service.rs`](./src/service.rs): This file defines the node implementation.
It's a place to configure consensus-related topics.
Loading
Loading