Proposal #58
Tech. Comm. #0xc466

Correct state after failed v6 migration

2yrs ago
2 Comments
Executed
Content
AI Summary
Reply
Up
Share
Business
Call
Metadata
Timeline2
Comments

How would a paranoid person check that the image above does what you say it does?
After the fact would be easy, I guess, but before?

Reply
Up

The call was generated with the following code:

import { ApiPromise, WsProvider } from '@polkadot/api';

async function main() {
    const wsProvider = new WsProvider('wss://api-kusama.interlay.io/parachain');
    const api = await ApiPromise.create({ provider: wsProvider });

    const preUpgradeApi = await api.at("0x3a4293ca2b4d24ea852b9510059cb8769e8321b3051bb690aef2703ebc74a65e");

    const allVaults = await preUpgradeApi.query.vaultRegistry.vaults.entries();
    const toSet = allVaults.map(([key, vault]) => {
        let vaultJSON: any = vault.toJSON();
        delete vaultJSON.wallet;
        if (vaultJSON.status.committedTheft === null) {
            vaultJSON.status = { liquidated: null };
        }
        const codec = api.createType("VaultRegistryVault", vaultJSON);

        return [key, codec.toHex()];
    });
    console.log(api.tx.system.setStorage(toSet).method.hash.toString());

    await api.disconnect();
}

main();
Reply
Up