darwinia-network / the-darwinia-book

Darwinia Traversal!
GNU General Public License v3.0
2 stars 0 forks source link

Migration and Fork Technical Practice and Guide #1

Open hackfisher opened 4 years ago

hackfisher commented 4 years ago

For Canary Testnet, there are some balances exists from the genesis config, some of them may come from the snapshot of IceFrog Testnet.

Besides, there might be snapshot requirement for later possible hardfork upgrade, maybe we should do a exercise between the IceFrog and Canary.

hackfisher commented 4 years ago

We can export the storage datas and serialize to scale codec format, here is a example data used in migration:

https://github.com/paritytech/substrate/blob/dd97b1478b31a4715df7e88a5ebc6664425fb6c6/frame/system/src/accounts.scale

Storage maps have iterator for scraping datas in specific storage map and export as scale format.

https://github.com/paritytech/substrate/blob/dd97b1478b31a4715df7e88a5ebc6664425fb6c6/frame/support/src/storage/generator/map.rs#L102

For snapshot, we only need to scraping the datas usable for the runtime migration or hard fork.

hackfisher commented 4 years ago

This is a good recipe about migration and forks, might good be documented in migration guides in the-darwinia-book.

hackfisher commented 4 years ago

The on_runtime_upgrade trigger could be useful to migration: https://github.com/paritytech/substrate/pull/5058