git.delta.rocks / unique-network / refs/commits / c656b7b0d499

difftreelog

add 942057 migration scripts

Max Andreev2023-06-09parent: #cd2a1cb.patch.diff
in: master

5 files changed

addedtests/src/migrations/942057-appPromotion/collect-data.shdiffbeforeafterboth
--- /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
addedtests/src/migrations/942057-appPromotion/collectData.tsdiffbeforeafterboth
--- /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']);
modifiedtests/src/migrations/942057-appPromotion/correctStateAfterMaintenance.tsdiffbeforeafterboth
--- 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) {
addedtests/src/migrations/942057-appPromotion/index.tsdiffbeforeafterboth
--- /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();
+  },
+};
modifiedtests/src/migrations/942057-appPromotion/lockedToFreeze.tsdiffbeforeafterboth
13 return isInteger(value) ? BigInt(value) : parseFloat(value);13 return isInteger(value) ? BigInt(value) : parseFloat(value);
14}14}
1515
16const main = async(options: { wsEndpoint: string; donorSeed: string } = {16export const migrateLockedToFreeze = async(options: { wsEndpoint: string; donorSeed: string } = {
17 wsEndpoint: WS_ENDPOINT,17 wsEndpoint: WS_ENDPOINT,
18 donorSeed: DONOR_SEED,18 donorSeed: DONOR_SEED,
19}) => {19}) => {
255 console.log('Chainql data correct');255 console.log('Chainql data correct');
256};256};
257257
258main({
259 wsEndpoint: process.env.WS_RPC!,
260 donorSeed: process.env.SUPERUSER_SEED!,
261}).then(() => process.exit(0))
262 .catch((e) => {
263 console.error(e);
264 process.exit(1);
265 });