Joystream / joystream

Joystream Monorepo
http://www.joystream.org
GNU General Public License v3.0
1.42k stars 115 forks source link

Identifying runtime migrations when updating substrate dependency #4889

Closed mnaamani closed 11 months ago

mnaamani commented 12 months ago

In recent Nara runtime upgrade work we decided to move to the latest version of substrate at the time.

Selecting a version

We "track" the version of substrate used by the polkadot production runtime. So we look at the polkadot repo releases

We selected https://github.com/paritytech/polkadot/releases/tag/v0.9.39

The information in the github release helps us select which version of the rust toolchain to use.

From the release commit we browse the files to runtime/polkadot/Cargo.toml

https://github.com/paritytech/polkadot/blob/bf2ebf30780ce176d16d67c1d313ca261f18233e/runtime/polkadot/Cargo.toml

and identify which branch of from the substrate repo is used for that release. In this example polkadot-v0.9.39 which is https://github.com/paritytech/substrate/tree/polkadot-v0.9.39

We use that as the base commit and add any customization in our fork: https://github.com/Joystream/substrate/commits/joystream-polkadot-v0.9.39-update (not one commit ontop of the last commit from substrate)

Migrations

Identifying migrations necessary to update from current version of substrate to v0.9.39 This is a simple but tedious exercise. Start with identifying the current release used by our runtime. Step through each polkadot release all the way upto to the target release. For each release look for the migrations implemented in he runtime usually in runtime/polkadot/src/lib.rs as pub type Migrations = (); for substrate pallets that are used in joystream runtime. Order them form oldest to latest migration.

In the upgrade from v0.9.24 to 0.9.39 the migrations are: https://github.com/Joystream/joystream/pull/4705/files#diff-be7fd8297e26596e9db5859251f45769ccf31a9d74c3e0206b2a12a383f7b5aeR95

┆Issue is synchronized with this Asana task by Unito

mnaamani commented 12 months ago

I found this useful checklist that we can perhaps follow ourselves https://github.com/paritytech/polkadot/issues/6781 and add to our CI checks.

Note that the polkadot and substrate repos have been archived/deprecated and "merged" into a single repo https://github.com/paritytech/polkadot-sdk

So for future updates the steps might be slightly different but the general concepts still apply.