# Migration checklist
## Preparation of the Migration
- [x] Shell recovery runtime spec, wasm and head created
- [x] Contains `system` pallets for operation as parachain
- [x] Contains `sudo` pallet
- [x] Contains `XCM` pallets
- [x] Live parachain (migrate from) runtime created
- [x] Contains `system` pallets for
- [x] Contains `XCM` pallets
- [x] Contains `utility` pallet
- [x] Increased `RuntimeVersion`
- [x] `type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::AnyRelayNumber;`
- [x] Use a proper NetworkId in XCM configuration.
- [x] `system.kill_storage` is not call-filtered
- [x] `system.set_storage` is not call-filtered
- [x] Consider any hooks that have an increased computational demand
- [x] Apply a call-filter to filter token transfers.
- [x] `balances` pallet
- [x] `currencies` pallet
- [x] `tokens` pallet
- [x] Apply a call-filter to business logic
- [x] `prediction-markets` pallet
- [x] `parachain-staking` pallet
- [x] `swaps` pallet
- [x] `styx` pallet
- [x] Shell recovery runtime spec, wasm and head created
- [x] Contains `system` pallets for operation as parachain
- [x] Contains `sudo` pallet
- [x] Contains `solo-to-para` pallet
~~- [ ] Reserved recovery parachain parachain id~~
~~- [ ] Registered recovery wasm and head for recovery parachain~~
- [x] Verified whole procedure by multiple people in a close-to-production environment. Sign here:
- Chris (signed)
- Harald
- Malte
- [x] Informed all node operators what they have to do
- [x] Informed partners (RPC, Subscan, Subsquare) what they have to do
- [x] Informed exchanges at which time deposit and withdrawal will be paused for which duration
- [x] Informed all other users what they have to do (get in comfortable state before filter)
- [x] Checked that the governance proposal includes proper calls to:
- [x] Unlocks the manger account
- [x] Deploy the minimal runtime
- [x] Batch-All 15 minutes after deployment:
- [x] resets `MqcHeads`
~~- [ ] swaps slot leases with recovery parachain~~
- [x] Sets the `parachain_id` to the one used on Polkadot
- [x] Reset slot in author-inherent
- [x] Updated polkadot.js/apps
- [x] Battery Station: https://github.com/polkadot-js/apps/pull/9087
- [x] Zeitgeist: https://github.com/polkadot-js/apps/pull/9086
## Executing the Migration (Rococo)
- [x] Fund parachain sovereign account on live parachain
- [x] Fund parachain sovereign account for shell parachain
- [x] Unlock shell parachain
- [x] Verify that shell parachain is unlocked: `registrar.paras(2101).locked == false`
- [x] Upgrade shell parachain with rococo-runtime: `0x0158e6f05d22befab8e595af52d9703fe9b9b309d91768e04759777c52ebd790`
- [x] `parachainSystem.authorizeUpgrade`
- [x] `parachainSystem.enactAuthorizedUpgrade`
- [x] Unlock live parachain
- [x] Verify live parachain is unlocked: `registrar.paras(2050).locked == false`
- [x] Upgrade live parachain to adjusted runtime: `0xc427dc75023956ad839ce15595bfba85de20c86c979106a29eaf606d3c48d5f7`
- [x] `parachainSystem.authorizeUpgrade`
- [x] `parachainSystem.enactAuthorizedUpgrade`
- [x] Wait 10min and then check that both `spec_version` have changed
- [x] Execute chain-halting call: `0x1f020c000504800d715f2646c8f85767b5d2764bb2782604a74d81251e398fd8a0a4d55023bb3f10350800000005088045323df7cc47150b3930e2666b0aa3133dca42deb008c6559ee789c9b9f70a2c250108ee07000000000000000000000000000000000000000000000000000000000000000000002a08000044c3832b01d79e9a4deb8d79f2ffec9936a9eb4895e29faeda3ce674cb9a502c8045323df7cc47150b3930e2666b0aa313911a5dd3f1155f5b7d0c5aa102a757f9805bd38c0b4f2826b506a9a89440dc067ef579651ee4dc33348e9a54adacbb985c00060480ab2a8d5eca218f218c6fda6b1d22bb926bc171ab77f6a731a6e80c34ee1eda19`
- Change the parachain id from 2050 to 2101
- Change MQC heads to those of the shell chain
- Reset `AuthorInherent::HighestSlotSeen`
- [x] Ensure that the parachain has halted
- [x] Inform the node operators that the chain has successfully halted
- [x] Read head from live parachain: `paras.heads(2050)`: `0x3986d82fc2e485f169a43bab5ca6e7715c2e187ac376485b7030c8310c6d38e39222ba00798820be7292869f1d273d86df86c95b7bb141e77bf363db64d836168455f9820b1bc6caa6e0850ac9769573beda46e0c286579126ce16358e820485967b178608066e6d62738058c5d7f5b01cfe6c94a5f540088313af0aa08eda11a47e4d7ebfaf4cd2983356056e6d62730101fc082b01efe9575fb61336086e9aae4c9dbd0bb2c41f1e971f5d60d8d429940c55b36112d891b48fc99148cdfbf6c02d20917d10a2c1cde7b89550efa827c285`
- [x] Execute `solo_to_para.migrate(runtime, head)`
- [x] Inform node operators to swap relaychain data and restart their nodes with the new chain spec
- [x] Replace Kusama relaychain data with Rococo relaychain data (during the upgrading "migrate")
- [x] Wait until the update has gone through
- [x] Verify that the chain produces blocks (via the relaychain)
- [x] Wait until cooldown on relaychain Rococo (~1 hour)
- [x] Upgrade from the migration runtime to production runtime
- [x] Lock live parachain
- [x] Lock shell parachain
## Executing the Migration (Polkadot)
- [x] Fund parachain sovereign account on live parachain: `0x7061726135080000000000000000000000000000000000000000000000000000`
- [x] Fund parachain sovereign account for shell parachain: `0x706172612c080000000000000000000000000000000000000000000000000000`
- [x] Unlock shell parachain: `0x96007a0001010002100004000000000700e40b540213000000000700e40b5402010700bca06501060003009435771846042c0800000d01000400010100706172612c080000000000000000000000000000000000000000000000000000`
- [x] Verify that shell parachain is unlocked: `registrar.paras(2092).locked == false`
- [x] Upgrade shell parachain with polkadot-runtime (`solo-to-para` + `utility`; `0xa4dff4eeeae96057af5d5723f0d861970716d5d0a0f85abd037e9df5a782f6b8`)
- [x] `parachainSystem.authorizeUpgrade`
- [x] `parachainSystem.enactAuthorizedUpgrade`
- [x] Unlock live parachain: `0x7a0001010002100004000000000700e876481713000000000700e8764817010700bca0650106000300943577184604350800000d0100040001010075377ef2134ba01437aedca468f8277177c5bd3f691e08af8099cd807edef81a`
- [x] Verify live parachain is unlocked: `registrar.paras(2101).locked == false`
- [x] Upgrade live parachain to adjusted runtime: `0xef115d61db247aab97924ff316b9abc95d831c8b53313556ab1490e4dfbdfaf2`
- [x] `parachainSystem.authorizeUpgrade`
- [x] `parachainSystem.enactAuthorizedUpgrade`
- [x] Wait 1 hour and then check that both `spec_version` have changed
- [X] Execute chain-halting call: `0x1f020c000504800d715f2646c8f85767b5d2764bb2782604a74d81251e398fd8a0a4d55023bb3f102c0800000006088045323df7cc47150b3930e2666b0aa313911a5dd3f1155f5b7d0c5aa102a757f98045323df7cc47150b3930e2666b0aa3133dca42deb008c6559ee789c9b9f70a2c00060480ab2a8d5eca218f218c6fda6b1d22bb926bc171ab77f6a731a6e80c34ee1eda19`
- Change the parachain id from 2101 to 2092
- Kill the MQC heads
- Reset `AuthorInherent::HighestSlotSeen`
- [x] Ensure that the parachain has halted
- [x] Inform node operators to swap relaychain data and restart their nodes with the new chain spec
- [x] Read head from live parachain: `paras.heads(2101)`: `0xc1a05ab112f2018eee0974d7d568cca48121977cac12988e3314ba6567a0eb86a28c9900da484331e47d03b8012cd6479f4a98c6b977a69784298fb7d316b8b646f18d2747c3cabaa5ac11bb68dcdb3cc26edb1d776a888a5a6ac93afc1d6f1637db148008066e6d6273802e9870ecb3b779e4ba2658e5208f51fb126e0a103b82df3004b5f0a58e11457f056e6d6273010186c049d412ab27b11a923b52c12cc468058fe71304d9fc1578c39b922f6277469aca1569de7e36de14949ac11383e6f85d0330bfccce91aa32eac4413607e38e`
- [x] Execute `solo_to_para.migrate(runtime, head)`
- [x] Wait until the update has gone through
- [x] Verify that the chain produces blocks
- [x] Wait until cooldown on relaychain Polkadot (~24h)
- [x] Upgrade from the migration runtime to production runtime (polkadot-runtime)
~~- [ ] Lock live parachain~~ (postponed since the purpose of the former live parachain has not been determined yet)
- [ ] Lock shell parachain
## Recovery
- [ ] Save block hash of last valid block (before halt)
- [ ] Generate Chainspec with bad_blocks and put in last valid block
- [ ] Sync the livechain exluding bad_blocks
- at least one bootnode should maintain the data of halted chain
- [ ] Change protocol id of previous chainspec
- [ ] Replace the previous chainspec with the new one and start node
- [ ] Distribute new chainspec to all node operators (to sync)
- [ ] Get latest head with [ExportHeader](https://github.com/zeitgeistpm/zeitgeist/blob/1f7ea6192eb9ad5921a99ad959e14d9065d8ca09/node/src/command.rs#L283-L298) of last valid block (before bad_blocks)
- [ ] Use manager to `registrar.set_current_head` on Kusama Relaychain to
- [ ] Maybe cancel any scheduled calls (which part of migration)
- [ ] lock parachain `registrar.add_lock`