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 #14

Closed
wants to merge 1 commit into from
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,276 changes: 0 additions & 15,276 deletions Cargo.lock

This file was deleted.

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

[workspace.dependencies]

parachain-template-runtime = { path = "./runtime" }
pallet-parachain-template = { path = "./pallets/template" }
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 = { version = "0.15.0", default-features = false }
cumulus-client-collator = { version = "0.15.0", default-features = false }
cumulus-client-consensus-aura = { version = "0.15.0", default-features = false }
cumulus-client-consensus-common = { version = "0.15.0", default-features = false }
cumulus-client-consensus-proposer = { version = "0.14.0", default-features = false }
cumulus-client-service = { version = "0.15.0", default-features = false }
cumulus-primitives-core = { version = "0.14.0", default-features = false }
cumulus-primitives-parachain-inherent = { version = "0.14.0", default-features = false }
cumulus-relay-chain-interface = { version = "0.15.0", default-features = false }
docify = { version = "0.2.8" }
frame-benchmarking = { version = "36.0.0", default-features = false }
frame-benchmarking-cli = { version = "40.0.0", default-features = false }
futures = { version = "0.3.30" }
jsonrpsee = { version = "0.23.2" }
log = { version = "0.4.21", default-features = false }
pallet-transaction-payment-rpc = { version = "38.0.0", default-features = false }
polkadot-cli = { version = "15.0.0", default-features = false }
polkadot-primitives = { version = "14.0.0", default-features = false }
prometheus-endpoint = { version = "0.17.0", default-features = false, package = "substrate-prometheus-endpoint" }
sc-basic-authorship = { version = "0.42.0", default-features = false }
sc-chain-spec = { version = "35.0.0", default-features = false }
sc-cli = { version = "0.44.0", default-features = false }
sc-client-api = { version = "35.1.0", default-features = false }
sc-consensus = { version = "0.41.0", default-features = false }
sc-executor = { version = "0.39.0", default-features = false }
sc-network = { version = "0.42.0", default-features = false }
sc-network-sync = { version = "0.41.0", default-features = false }
sc-offchain = { version = "37.0.0", default-features = false }
sc-rpc = { version = "37.0.0", default-features = false }
sc-service = { version = "0.43.0", default-features = false }
sc-sysinfo = { version = "35.0.0", default-features = false }
sc-telemetry = { version = "22.0.0", default-features = false }
sc-tracing = { version = "35.0.0", default-features = false }
sc-transaction-pool = { version = "35.0.0", default-features = false }
sc-transaction-pool-api = { version = "35.0.0", default-features = false }
serde = { version = "1.0.197", default-features = false }
serde_json = { version = "1.0.114", default-features = false }
sp-api = { version = "33.0.0", default-features = false }
sp-block-builder = { version = "33.0.0", default-features = false }
sp-blockchain = { version = "35.1.0", default-features = false }
sp-consensus-aura = { version = "0.39.0", default-features = false }
sp-core = { version = "34.0.0", default-features = false }
sp-io = { version = "37.0.0", default-features = false }
sp-keystore = { version = "0.40.0", default-features = false }
sp-runtime = { version = "38.0.0", default-features = false }
sp-timestamp = { version = "33.0.0", default-features = false }
substrate-frame-rpc-system = { version = "36.0.0", default-features = false }
xcm = { version = "14.0.1", default-features = false, package = "staging-xcm" }
substrate-build-script-utils = { version = "11.0.0", default-features = false }
cumulus-pallet-aura-ext = { version = "0.15.0", default-features = false }
cumulus-pallet-parachain-system = { version = "0.15.0", default-features = false }
cumulus-pallet-session-benchmarking = { version = "17.0.0", default-features = false }
cumulus-pallet-xcm = { version = "0.15.0", default-features = false }
cumulus-pallet-xcmp-queue = { version = "0.15.0", default-features = false }
cumulus-primitives-aura = { version = "0.14.0", default-features = false }
cumulus-primitives-storage-weight-reclaim = { version = "6.0.0", default-features = false }
cumulus-primitives-utility = { version = "0.15.0", default-features = false }
frame-executive = { version = "36.0.0", default-features = false }
frame-metadata-hash-extension = { version = "0.4.0", default-features = false }
frame-support = { version = "36.0.0", default-features = false }
frame-system = { version = "36.0.0", default-features = false }
frame-system-benchmarking = { version = "36.0.0", default-features = false }
frame-system-rpc-runtime-api = { version = "33.0.0", default-features = false }
frame-try-runtime = { version = "0.42.0", default-features = false }
hex-literal = { version = "0.4.1", default-features = false }
pallet-aura = { version = "35.0.0", default-features = false }
pallet-authorship = { version = "36.0.0", default-features = false }
pallet-balances = { version = "37.0.0", default-features = false }
pallet-collator-selection = { version = "17.0.0", default-features = false }
pallet-message-queue = { version = "39.0.0", default-features = false }
pallet-session = { version = "36.0.0", default-features = false }
pallet-sudo = { version = "36.0.0", default-features = false }
pallet-timestamp = { version = "35.0.0", default-features = false }
pallet-transaction-payment = { version = "36.0.0", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { version = "36.0.0", default-features = false }
pallet-xcm = { version = "15.0.0", default-features = false }
parachain-info = { version = "0.15.0", default-features = false, package = "staging-parachain-info" }
parachains-common = { version = "15.0.0", default-features = false }
polkadot-parachain-primitives = { version = "13.0.0", default-features = false }
polkadot-runtime-common = { version = "15.0.0", default-features = false }
scale-info = { version = "2.11.1", default-features = false }
smallvec = { version = "1.11.0", default-features = false }
sp-genesis-builder = { version = "0.14.0", default-features = false }
sp-inherents = { version = "33.0.0", default-features = false }
sp-offchain = { version = "33.0.0", default-features = false }
sp-session = { version = "34.0.0", default-features = false }
sp-std = { version = "14.0.0", default-features = false }
sp-transaction-pool = { version = "33.0.0", default-features = false }
sp-version = { version = "36.0.0", default-features = false }
xcm-builder = { version = "15.0.0", default-features = false, package = "staging-xcm-builder" }
xcm-executor = { version = "15.0.0", default-features = false, package = "staging-xcm-executor" }
substrate-wasm-builder = { version = "23.0.0", default-features = false }

[workspace.dev-dependencies]
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM docker.io/paritytech/ci-unified:latest as builder

WORKDIR /polkadot
COPY . /polkadot

RUN cargo fetch
RUN cargo build --locked --release

FROM docker.io/parity/base-bin:latest

COPY --from=builder /polkadot/target/release/parachain-template-node /usr/local/bin

USER root
RUN useradd -m -u 1001 -U -s /bin/sh -d /polkadot polkadot && \
mkdir -p /data /polkadot/.local/share && \
chown -R polkadot:polkadot /data && \
ln -s /data /polkadot/.local/share/polkadot && \
# unclutter and minimize the attack surface
rm -rf /usr/bin /usr/sbin && \
# check if executable works in this container
/usr/local/bin/parachain-template-node --version

USER polkadot

EXPOSE 30333 9933 9944 9615
VOLUME ["/data"]

ENTRYPOINT ["/usr/local/bin/parachain-template-node"]
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/).
Loading
Loading