zeitgeist
zeitgeist copied to clipboard
Add a script to test runtime upgrades and migrations
We can test runtime upgrades by cloning the state of Battery Park and creating a test chain based on the same state. The steps for doing this are as follows:
- Sync a node to Battery Park with
--pruning archiveenabled - Stop the node
- Use
zeitgeist export-state <HEAD> --chain battery_park --pruning archive > bp_clone.jsonwhere <HEAD> is replaced by the head of the chain that was synced - Change the authority in
bp_clone.jsonto Alice so that we can run the chain locally. This is done by replacing the value stored at key0x57f8dc2f5ab09467896f47300f0424385e0621c4869aa60c02be9adcc98a0d1dwith0x04d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d - Start a chain
zeitgeist --chain ./bp_clone.json --alice - Separately build the new Wasm blob for the runtime
- Execute the upgrade using the new Wasm blob on battery park clone
- Run integration tests
- If the chain continues to produce blocks, and integration tests pass, then the runtime upgrade is safe to execute on the public testnet as a next step
Integration Tests
We may want a small suite of integration tests that make a simple sanity check for when performing the process above. Additionally, for every time a runtime storage migration is needed, we should require that a minimal integration test is written to ensure that the storage migrates as expected.