From c656b7b0d4993fd6cc3353244580c870f21ab10c Mon Sep 17 00:00:00 2001 From: Max Andreev Date: Fri, 09 Jun 2023 14:04:39 +0000 Subject: [PATCH] add 942057 migration scripts --- --- /dev/null +++ b/tests/src/migrations/942057-appPromotion/collect-data.sh @@ -0,0 +1 @@ +chainql --tla-str=chainUrl=ws://127.0.0.1:9944 stakersParser.jsonnet > output.json \ No newline at end of file --- /dev/null +++ b/tests/src/migrations/942057-appPromotion/collectData.ts @@ -0,0 +1,3 @@ +import {spawnSync} from 'child_process'; + +export const collectData = () => spawnSync('sh', ['./collect-data.sh']); --- a/tests/src/migrations/942057-appPromotion/correctStateAfterMaintenance.ts +++ b/tests/src/migrations/942057-appPromotion/correctStateAfterMaintenance.ts @@ -49,7 +49,6 @@ const failedBlocks: bigint[] = []; let isSuccess = true; - await helper.wait.newBlocks(1); for(const b of filteredBlocks) { if(((await api.query.appPromotion.pendingUnstake(b)).toJSON() as any[]).length != 0) { --- /dev/null +++ b/tests/src/migrations/942057-appPromotion/index.ts @@ -0,0 +1,12 @@ +import {Migration} from '../../util/frankensteinMigrate'; +import {collectData} from './collectData'; +import {migrateLockedToFreeze} from './lockedToFreeze'; + +export const migration: Migration = { + async before() { + await collectData(); + }, + async after() { + await migrateLockedToFreeze(); + }, +}; --- a/tests/src/migrations/942057-appPromotion/lockedToFreeze.ts +++ b/tests/src/migrations/942057-appPromotion/lockedToFreeze.ts @@ -13,7 +13,7 @@ return isInteger(value) ? BigInt(value) : parseFloat(value); } -const main = async(options: { wsEndpoint: string; donorSeed: string } = { +export const migrateLockedToFreeze = async(options: { wsEndpoint: string; donorSeed: string } = { wsEndpoint: WS_ENDPOINT, donorSeed: DONOR_SEED, }) => { @@ -254,12 +254,3 @@ } console.log('Chainql data correct'); }; - -main({ - wsEndpoint: process.env.WS_RPC!, - donorSeed: process.env.SUPERUSER_SEED!, -}).then(() => process.exit(0)) - .catch((e) => { - console.error(e); - process.exit(1); - }); \ No newline at end of file -- gitstuff