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 ib-make-node-compilation-optional #19

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,384 changes: 0 additions & 15,384 deletions Cargo.lock

This file was deleted.

99 changes: 12 additions & 87 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ repository = "https://github.com/paritytech/polkadot-sdk-parachain-template.git"
edition = "2021"

[workspace]
"default-members" = ["pallets/template", "runtime"]
# add to the build command to build all members
members = [
"node",
"pallets/template",
Expand All @@ -16,97 +18,20 @@ resolver = "2"
[workspace.dependencies]
parachain-template-runtime = { path = "./runtime", default-features = false }
pallet-parachain-template = { path = "./pallets/template", default-features = false }
clap = { version = "4.5.3" }
clap = { version = "4.5.13" }
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
color-print = { version = "0.3.4" }
cumulus-client-cli = { version = "0.17.0", default-features = false }
cumulus-client-collator = { version = "0.17.0", default-features = false }
cumulus-client-consensus-aura = { version = "0.17.1", default-features = false }
cumulus-client-consensus-common = { version = "0.17.0", default-features = false }
cumulus-client-consensus-proposer = { version = "0.15.0", default-features = false }
cumulus-client-service = { version = "0.17.0", default-features = false }
cumulus-primitives-core = { version = "0.15.0", default-features = false }
cumulus-primitives-parachain-inherent = { version = "0.15.0", default-features = false }
cumulus-relay-chain-interface = { version = "0.17.0", default-features = false }
docify = { version = "0.2.8" }
frame-benchmarking = { version = "37.0.0", default-features = false }
frame-benchmarking-cli = { version = "42.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 = "40.0.0", default-features = false }
polkadot-cli = { version = "17.0.0", default-features = false }
polkadot-primitives = { version = "15.0.0", default-features = false }
prometheus-endpoint = { version = "0.17.0", default-features = false, package = "substrate-prometheus-endpoint" }
sc-basic-authorship = { version = "0.44.0", default-features = false }
sc-chain-spec = { version = "37.0.0", default-features = false }
sc-cli = { version = "0.46.0", default-features = false }
sc-client-api = { version = "37.0.0", default-features = false }
sc-consensus = { version = "0.43.0", default-features = false }
sc-executor = { version = "0.40.0", default-features = false }
sc-network = { version = "0.44.0", default-features = false }
sc-network-sync = { version = "0.43.0", default-features = false }
sc-offchain = { version = "39.0.0", default-features = false }
sc-rpc = { version = "39.0.0", default-features = false }
sc-service = { version = "0.45.0", default-features = false }
sc-sysinfo = { version = "37.0.0", default-features = false }
sc-telemetry = { version = "24.0.0", default-features = false }
sc-tracing = { version = "37.0.0", default-features = false }
sc-transaction-pool = { version = "37.0.0", default-features = false }
sc-transaction-pool-api = { version = "37.0.0", default-features = false }
serde = { version = "1.0.197", default-features = false }
serde_json = { version = "1.0.121", default-features = false }
sp-api = { version = "34.0.0", default-features = false }
sp-block-builder = { version = "34.0.0", default-features = false }
sp-blockchain = { version = "37.0.1", default-features = false }
sp-consensus-aura = { version = "0.40.0", default-features = false }
sp-core = { version = "34.0.0", default-features = false }
sp-io = { version = "38.0.0", default-features = false }
sp-keystore = { version = "0.40.0", default-features = false }
sp-runtime = { version = "39.0.0", default-features = false }
sp-timestamp = { version = "34.0.0", default-features = false }
substrate-frame-rpc-system = { version = "38.0.0", default-features = false }
xcm = { version = "14.1.0", default-features = false, package = "staging-xcm" }
substrate-build-script-utils = { version = "11.0.0", default-features = false }
cumulus-pallet-aura-ext = { version = "0.16.0", default-features = false }
cumulus-pallet-parachain-system = { version = "0.16.0", default-features = false }
cumulus-pallet-session-benchmarking = { version = "18.0.0", default-features = false }
cumulus-pallet-xcm = { version = "0.16.0", default-features = false }
cumulus-pallet-xcmp-queue = { version = "0.16.0", default-features = false }
cumulus-primitives-aura = { version = "0.15.0", default-features = false }
cumulus-primitives-storage-weight-reclaim = { version = "7.0.1", default-features = false }
cumulus-primitives-utility = { version = "0.16.0", default-features = false }
frame-executive = { version = "37.0.0", default-features = false }
frame-metadata-hash-extension = { version = "0.5.0", default-features = false }
frame-support = { version = "37.0.0", default-features = false }
frame-system = { version = "37.1.0", default-features = false }
frame-system-benchmarking = { version = "37.0.0", default-features = false }
frame-system-rpc-runtime-api = { version = "34.0.0", default-features = false }
frame-try-runtime = { version = "0.43.0", default-features = false }
jsonrpsee = { version = "0.24.3" }
log = { version = "0.4.22", default-features = false }
polkadot-sdk = { path = "umbrella", default-features = false }
prometheus-endpoint = { path = "substrate/utils/prometheus", default-features = false, package = "substrate-prometheus-endpoint" }
sc-tracing = { path = "substrate/client/tracing", default-features = false }
serde = { version = "1.0.210", default-features = false }
serde_json = { version = "1.0.132", default-features = false }
cumulus-pallet-parachain-system = { path = "cumulus/pallets/parachain-system", default-features = false }
hex-literal = { version = "0.4.1", default-features = false }
pallet-aura = { version = "36.0.0", default-features = false }
pallet-authorship = { version = "37.0.0", default-features = false }
pallet-balances = { version = "38.0.0", default-features = false }
pallet-collator-selection = { version = "18.0.0", default-features = false }
pallet-message-queue = { version = "40.0.0", default-features = false }
pallet-session = { version = "37.0.0", default-features = false }
pallet-sudo = { version = "37.0.0", default-features = false }
pallet-timestamp = { version = "36.0.1", default-features = false }
pallet-transaction-payment = { version = "37.0.0", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { version = "37.0.0", default-features = false }
pallet-xcm = { version = "16.0.0", default-features = false }
parachain-info = { version = "0.16.0", default-features = false, package = "staging-parachain-info" }
parachains-common = { version = "17.0.0", default-features = false }
polkadot-parachain-primitives = { version = "14.0.0", default-features = false }
polkadot-runtime-common = { version = "16.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.15.0", default-features = false }
sp-inherents = { version = "34.0.0", default-features = false }
sp-offchain = { version = "34.0.0", default-features = false }
sp-session = { version = "35.0.0", default-features = false }
sp-transaction-pool = { version = "34.0.0", default-features = false }
sp-version = { version = "37.0.0", default-features = false }
xcm-builder = { version = "16.0.0", default-features = false, package = "staging-xcm-builder" }
xcm-executor = { version = "16.0.0", default-features = false, package = "staging-xcm-executor" }
substrate-wasm-builder = { version = "24.0.0", default-features = false }
substrate-wasm-builder = { path = "substrate/utils/wasm-builder", default-features = false }
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /polkadot
COPY . /polkadot

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

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

Expand Down
78 changes: 67 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,92 @@ A Polkadot SDK based project such as this one consists of:
* 🛠️ 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.

Fetch parachain template code:

```sh
git clone https://github.com/paritytech/polkadot-sdk-parachain-template.git parachain-template

cd parachain-template
```

### Build

🔨 Use the following command to build the node without launching it:
🔨 Use the following command to build just the `runtime`. There is also
a `node` crate that when started can load the runtime accordingly, but the
recommended way of running the template is with `Omni Node` (TODO: add link to the docs).


```sh
cargo build --package parachain-template-node --release
cargo build --release
```

🐳 Alternatively, build the docker image:
### Local Development Chain with Omni Node

⬇️ Omni Node can run by using the `polkadot-omni-node` binary, which can be downloaded
from [Polkadot SDK releases](https://github.com/paritytech/polkadot-sdk/releases/latest).

🔗 Once downloaded, add it to the `PATH` environment variable like so:

```sh
export PATH="<path-to-binary>:$PATH"
```

↩️ If not already built, we should build the `runtime` and generate a development chain spec.
The chain spec will be passed to the Omni Node binary when starting it.

```sh
docker build . -t polkadot-sdk-parachain-template
# Build the parachain runtime.
cargo build --release
# Install chain-spec-builder if not installed already.
cargo install staging-chain-spec-builder
# Use chain-spec-builder to generate the chain_spec.json file based on the development preset.
chain-spec-builder create --relay-chain "rococo-local" --para-id 1000 --runtime \
<target/release/wbuild/path/to/parachain-template-runtime.wasm> named-preset development
```

⚙️ The `relay-chain` and `para-id` flags in the chain spec generation above are extra bits of
information required to configure the node in relation to its parachain id (which must be set
to `1000` for the parachain template, to be the same as the `ParachainInfo` pallet [genesis config](https://github.com/paritytech/polkadot-sdk/blob/master/templates/parachain/runtime/src/genesis_config_presets.rs)).
The `relay-chain` must correspond to the relay chain id where the parachain connects to.

We'll start Omni Node with zombienet, but before doing that we must update the path to the
`chain_spec.json` file in the `parachains` section of the `zombienet-omni-node.toml` file,
which holds the zombienet network specification:

```toml
# ...
[[parachains]]
id = 1000
# insert the correct path on your file system
chain_spec_path = "<path/to/chain_spec.json>"
# ...
```

🚀 Start the parachain runtime with Omni Node like below. This will
start two relay chain nodes and one collator node:

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

### 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.
This template produces a parachain node. You can install it in your environment by running:

```sh
cargo install --path 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"
```
In addition to the installed parachain node, make sure to bring
`zombienet`, `polkadot`, `polkadot-prepare-worker`, and `polkadot-execute-worker`
into `PATH`.

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

Expand Down
119 changes: 19 additions & 100 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "parachain-template-node"
description = "A parachain node template built with Substrate and Cumulus, part of Polkadot Sdk. (polkadot v1.15.0)"
version = "0.1.0"
description = "A parachain node template built with Substrate and Cumulus, part of Polkadot Sdk."
version = "0.0.0"
license = "Unlicense"
authors.workspace = true
homepage.workspace = true
Expand All @@ -10,9 +10,6 @@ edition.workspace = true
publish = false
build = "build.rs"

# [[bin]]
# name = "parachain-template-node"

[dependencies]
clap = { features = ["derive"], workspace = true }
log = { workspace = true, default-features = true }
Expand All @@ -22,109 +19,31 @@ jsonrpsee = { features = ["server"], workspace = true }
futures = { workspace = true }
serde_json = { workspace = true, default-features = true }
docify = { workspace = true }
parachain-template-runtime.workspace = true
frame-benchmarking.workspace = true
frame-benchmarking.default-features = true
frame-benchmarking-cli.workspace = true
frame-benchmarking-cli.default-features = true
pallet-transaction-payment-rpc.workspace = true
pallet-transaction-payment-rpc.default-features = true
sc-basic-authorship.workspace = true
sc-basic-authorship.default-features = true
sc-chain-spec.workspace = true
sc-chain-spec.default-features = true
sc-cli.workspace = true
sc-cli.default-features = true
sc-client-api.workspace = true
sc-client-api.default-features = true
sc-offchain.workspace = true
sc-offchain.default-features = true
sc-consensus.workspace = true
sc-consensus.default-features = true
sc-executor.workspace = true
sc-executor.default-features = true
sc-network.workspace = true
sc-network.default-features = true
sc-network-sync.workspace = true
sc-network-sync.default-features = true
sc-rpc.workspace = true
sc-rpc.default-features = true
sc-service.workspace = true
sc-service.default-features = true
sc-sysinfo.workspace = true
sc-sysinfo.default-features = true
sc-telemetry.workspace = true
sc-telemetry.default-features = true
sc-tracing.workspace = true
sc-tracing.default-features = true
sc-transaction-pool.workspace = true
sc-transaction-pool.default-features = true
sc-transaction-pool-api.workspace = true
sc-transaction-pool-api.default-features = true
sp-api.workspace = true
sp-api.default-features = true
sp-block-builder.workspace = true
sp-block-builder.default-features = true
sp-blockchain.workspace = true
sp-blockchain.default-features = true
sp-consensus-aura.workspace = true
sp-consensus-aura.default-features = true
sp-core.workspace = true
sp-core.default-features = true
sp-keystore.workspace = true
sp-keystore.default-features = true
sp-io.workspace = true
sp-io.default-features = true
sp-runtime.workspace = true
sp-runtime.default-features = true
sp-timestamp.workspace = true
sp-timestamp.default-features = true
substrate-frame-rpc-system.workspace = true
substrate-frame-rpc-system.default-features = true
prometheus-endpoint.workspace = true
prometheus-endpoint.default-features = true
polkadot-cli = { features = ["rococo-native"], workspace = true, default-features = true }
polkadot-primitives.workspace = true
polkadot-primitives.default-features = true
xcm.workspace = true
cumulus-client-cli.workspace = true
cumulus-client-cli.default-features = true
cumulus-client-collator.workspace = true
cumulus-client-collator.default-features = true
cumulus-client-consensus-aura.workspace = true
cumulus-client-consensus-aura.default-features = true
cumulus-client-consensus-common.workspace = true
cumulus-client-consensus-common.default-features = true
cumulus-client-consensus-proposer.workspace = true
cumulus-client-consensus-proposer.default-features = true
cumulus-client-service.workspace = true
cumulus-client-service.default-features = true
cumulus-primitives-core.workspace = true
cumulus-primitives-core.default-features = true
cumulus-primitives-parachain-inherent.workspace = true
cumulus-primitives-parachain-inherent.default-features = true
cumulus-relay-chain-interface.workspace = true
cumulus-relay-chain-interface.default-features = true
color-print = { workspace = true }

polkadot-sdk = { workspace = true, features = ["node"] }

parachain-template-runtime = { workspace = true }

# Substrate
sc-tracing = { workspace = true, default-features = true }
prometheus-endpoint = { workspace = true, default-features = true }

[build-dependencies]
substrate-build-script-utils.workspace = true
substrate-build-script-utils.default-features = true
polkadot-sdk = { workspace = true, features = ["substrate-build-script-utils"] }

[features]
default = []
default = ["std"]
std = [
"log/std",
"parachain-template-runtime/std",
"polkadot-sdk/std",
]
runtime-benchmarks = [
"cumulus-primitives-core/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"parachain-template-runtime/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"polkadot-sdk/runtime-benchmarks",
]
try-runtime = [
"parachain-template-runtime/try-runtime",
"polkadot-cli/try-runtime",
"sp-runtime/try-runtime",
"polkadot-sdk/try-runtime",
]
2 changes: 1 addition & 1 deletion node/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
use polkadot_sdk::substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};

fn main() {
generate_cargo_keys();
Expand Down
Loading
Loading