Runtime Migration #2828
Labels
documentation
estimate-40h
Stub for the future decomposition.
giza
migration
Migration of state to new chains
This is a note to be used as a reference in case of future (storage) migrations
Runtime Side
u32
is fine) in his storage space, I call thison_chain_version
u32
is fine) hardcoded in the module. I call thiscurrent_storage_version
Hence I would like to propose this approach this implementation approach for each pallet
Module<T>
. Hencelet CHECK = on_chain_version != current_storage_version
, ifCHECK == true
migration is needed.on_runtime_upgrade
inruntime/src/runtime_api.rs
call the appropriatemigrate_to_v2
functionTesting
4 current ways to test the runtime upgrade
Sumer
->Giza
:Sumer
, the other withGiza
) run one test scenario onSumer
in order to create some state to mess up with, then perform the migration and complete assertion launching a test scenario from gizaSumer
augmented api into asumer.js
file using webpack and import it into theGiza
test scenariosremote externalities
/try_runtime
utils: this allowes to download a state snapshot of a live chain at a specified block height. This is more similar to a unit test since it download and executes rust code into a sandbox environment in which you can verify pre/post migration invariants/assertions.Fork off tool
Seems the most promising, and it is the workflow that best fit the current integration testing framework.
I edited the forkoff script that clones the provided
Sumer
storage into a chainspec file. It does not preserve the Set of validator set seePlus a problem on the HTTP endpoint side of the RPC server forces me to download the current state with a. What the script essentially does is the following: starting with acurl
query instead of using
polkadotJs
@rpc/HttpProvider
--dev
Sumer
-compatible chainspec file copy the state from thestorage.json
dump into a the specified chainspec. The runtime version is also copied into thegenesis.
I need to put the Giza wasm runtime in the test/data_tmp folder with the generated chain-spec.
fork-off changes the
runtime-code
value on the chain-spec to the hex dump of the runtime .wasm (so no need to set migrationcode via Tx).
Then we can run the
post-migration-scenario
The text was updated successfully, but these errors were encountered: