State Trie Migration

The trie format of substrate has changed recently in order to become more PoV-friendly. Once done a state_version field has appeared in each chain’s runtime specification, where 0 is the old format, and 1 is the new format.

Migrating to the new trie can happen lazily, and technically, setting the version to 1 will put your trie in a hybrid mode where keys will be lazily migrated as they are read. This is okay, but it is a small overhead and it might take a long time until the state is fully migrated.

This is why we wrote a special pallet that can be configured to read and write all storage keys in the background, in a safe way, to facilitate the migration.

I wrote a guide about this a long time ago, which some of you might have already seen, but I want to re-share it again: Substrate State Trie Migration Guide - HackMD.

I am aware that Parity is in the process of migrating our testnets using the mentioned tool and method, and I will ask them to share their outcome here once done. Until then, I suggest being extra cautious when it comes to performing the migration.

And we can use this thread to share our experience performing the migration and help with troubleshooting.

Good luck!

5 Likes

Yes, that is the current plan. I want that we try on Rococo and on all of the Parachains we control there. Then do the same again for Westend. While doing this we probably also improve the guide even more to make it easier and more approachable.

After all of that this done, we will be able to move on to do this for Kusama/Polkadot and the Parachains.

2 Likes