6 releases
new 0.1.6 | Dec 24, 2024 |
---|---|
0.1.5 | Dec 24, 2024 |
#248 in Development tools
58 downloads per month
62KB
702 lines
Polkadot Runtime Releaser
Streamline the process of releasing a new runtime for the Polkadot-SDK-based chain.
Setup Guide
Polkadot Runtime Releaser CLI
Install from Source Code
git clone https://github.com/hack-ink/polkadot-runtime-releaser
cd polkadot-runtime-releaser
cargo install --path cli
Install from crates.io
cargo install polkadot-runtime-releaser-cli
Install from GitHub
# macOS
curl -L https://github.com/hack-ink/polkadot-runtime-releaser/releases/latest/download/prr-aarch64-apple-darwin.zip \
-o prr.zip &&
unzip prr.zip &&
chmod u+x prr &&
rm prr.zip
# Linux
curl -L https://github.com/hack-ink/polkadot-runtime-releaser/releases/latest/download/prr-x86_64-unknown-linux-gnu.tar.gz |
tar xz &&
chmod u+x prr
# If you like to move the binary to `~/.local/bin`. (OPTIONAL)
mkdir -p ~/.local/bin && mv prr ~/.local/bin
Rust Toolchain
Having a fixed version of Rust toolchain is one of the crucial parts of building a deterministic runtime.
Create a rust-toolchain.toml
file in the root of your project and add the following content:
[toolchain]
# Using Rust `stable` as an example, you can replace it with your desired version.
channel = "stable"
# `clippy`, `rust-src` and `rustfmt` are optional, you can remove them if you don't need them.
components = ["cargo", "clippy", "rust-src", "rustc", "rustfmt"]
# `minimal` is the basic and minimal one to build the runtime, you can choose the profile that you need.
# https://rust-lang.github.io/rustup/concepts/profiles.html.
profile = "minimal"
targets = ["wasm32-unknown-unknown"]
With this file in place, PPR will automatically use the specified version of Rust toolchain.
This is the best way to manage the Rust toolchain version for your project.
If you don't have a rust-toolchain.toml
file, PPR will automatically generate one with the stable
version for you.
PPR also supports configuring the Rust toolchain version while there isn't a rust-toolchain.toml
file in the root of your project. Use ppr build --help
to get more information.
Docker
The second crucial part of building a deterministic runtime is to use the same environment for building the runtime.
We use Docker to create a deterministic environment for building the runtime.
So, to use the runtime build feature, you need to have Docker installed on your system.
The default image is polkadot-runtime-releaser, which is maintained by hack-ink community. It has a well-configured environment for building the runtime. Each release is sticked to a specific version of the image for creating a deterministic environment. But you can use -v
or --image-version
flag to use a specific version of the image.
PPR also supports using a custom Docker image. Use ppr build --help
to get more information.
Runtime
IMPORTANT NOTES
- PRR makes some assumption while deal with the runtime artifacts.
- Runtime crate name is in
{}-runtime
format. E.G.polkadot-runtime
- WASM file name is in
{}_runtime.compact.compressed.wasm
format. E.G.polkadot_runtime.compact.compressed.wasm
- Runtime crate name is in
GitHub
Usage
Build Deterministic Runtime
Example
git clone https://github.com/polkadot-fellows/runtimes.git
cd runtimes
prr build polkadot-runtime -f on-chain-release-build
Inspect Runtime WASM
prr inspect <RUNTIME_WASM_FILE>
License
Licensed under GPL-3.0.
Dependencies
~75MB
~1.5M SLoC