Back to Proposals
Correct state after failed v6 migration
1mo ago
Executed

Due to a bug in the v6 VaultRegistry migration all Vaults now have an incorrect number of issued_tokens which puts many below the liquidation threshold. Fortunately, the stake stored in VaultRewards is still correct which prevents liquidation since that number is smaller than the value trying to be liquidated.

This fix manually forces the VaultRegistry to the correct state which was determined by querying the storage prior to runtime upgrade and applying the expected migration function. More details to follow in our post-mortem.

Request for TC fast-track to minimize system downtime.

Edited
Reply
Up
Share
Business
Metadata
Proposer
Threshold
1
Hash
0xc4665c774cb068944d8cc6a99f22af80f8c7dac7a9745bbc9acff80c01343be1
Call
Table
Json
callIndex0x4603
sectiondemocracy
methodfastTrack
args
propIndex58
delay3
TimelineLatest activity 1mo ago
2022-08-08 16:30:12
Proposed
2022-08-08 16:30:12
Executed
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
1mo ago

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