How to make a parachain runtime upgrade
This post should get you through the workflow of making a runtime upgrade for your parachain.
First you need to have a running parachain on a local or live testnet of some kind. The chain needs to be producing blocks, and you need to have the sudo key of the chain.
Bump version and compile
Make sure to bump up the relevant version in your `runtime/src/lib.rs` file, if its a change to the runtime you need to increase the `impl version`, but if the function of the extrinsics are changed you will also need to bump the `spec version`. More here.
Get and save new runtime wasm blob
Create a build spec to extract the wasm code.
./target/release/parachain-collator build-spec —chain dev > upgraded-chain.json
or in general terms:
./target/release/<name of your target binary> build-spec --chain <any command that targets the correct chain spec, but really shouldn't matter, "dev" may do> > <name of the output file you export the chain spec to>.json
Once the build spec is created containing the updated wasm blob, we find the file and copy the code and save it in its own file we are calling ours Kabocha-release-blov-v0.1.4, you can name yours as you wish.
In live conditions you will want to use SRTOOL to guarantee that the code is in the right place, which makes it easily verifiable by others. https://www.chevdor.com/project/2020/2020-srtool/
Make the upgrade on-chain
Then we need to inform the relay chain we will be running an upgrade, so we send them a hash of our wasm blob via a sudo extrinsic call from our parachain.
sudo > parachainSystem > AuthorizeUpgrade
Once that has been submitted correctly then:
sudo > parachainSystem > enactAuthorizedUpgrade
Completed : )
If you increased the spec version, you will see the new spec version in the top left of your polkadot-js apps UI screen.
All the best,