difftreelog
add before and after hooks to frankenstein
in: master
3 files changed
.envdiffbeforeafterboth--- a/.env
+++ b/.env
@@ -2,6 +2,7 @@
POLKADOT_LAUNCH_BRANCH=unique-network
RELAY_CHAIN_TYPE=westend
CHAINQL=v0.4.1
+DESTINATION_SPEC_VERSION=v942057
POLKADOT_MAINNET_BRANCH=release-v0.9.37
STATEMINT_BUILD_BRANCH=release-parachains-v9370
tests/src/util/frankenstein.tsdiffbeforeafterboth20import {readNetworkConfig} from '@zombienet/utils/dist';20import {readNetworkConfig} from '@zombienet/utils/dist';21import {resolve} from 'path';21import {resolve} from 'path';22import {usingPlaygrounds} from '.';22import {usingPlaygrounds} from '.';23import {migrations} from './frankensteinMigrate';23import fs from 'fs';24import fs from 'fs';242525const ZOMBIENET_CREDENTIALS = process.env.ZOMBIENET_CREDENTIALS || '../.env';26const ZOMBIENET_CREDENTIALS = process.env.ZOMBIENET_CREDENTIALS || '../.env';245 await waitWithTimer(relayInfo.epochTime);246 await waitWithTimer(relayInfo.epochTime);246 }247 }247248249 const migration = migrations[process.env.DESTINATION_SPEC_VERSION!];248 for(const paraId in network.paras) {250 for(const paraId in network.paras) {249 console.log(`\n--- Upgrading the runtime of parachain ${paraId} \t---`);251 console.log(`\n--- Upgrading the runtime of parachain ${paraId} \t---`);250 const para = network.paras[paraId];252 const para = network.paras[paraId];251253252 // Enable maintenance mode if present254 // Enable maintenance mode if present253 await toggleMaintenanceMode(true, para.nodes[0].wsUri);255 await toggleMaintenanceMode(true, para.nodes[0].wsUri);256 if(migration) await migration.before();254257255 // Read the WASM code and authorize the upgrade with its hash and set it as the new runtime258 // Read the WASM code and authorize the upgrade with its hash and set it as the new runtime256 const code = fs.readFileSync(NEW_PARA_WASM);259 const code = fs.readFileSync(NEW_PARA_WASM);324327325 // Disable maintenance mode if present328 // Disable maintenance mode if present326 for(const paraId in network.paras) {329 for(const paraId in network.paras) {330 // TODO only if our parachain331 if(migration) await migration.after();327 await toggleMaintenanceMode(false, network.paras[paraId].nodes[0].wsUri);332 await toggleMaintenanceMode(false, network.paras[paraId].nodes[0].wsUri);328 }333 }329 } else {334 } else {tests/src/util/frankensteinMigrate.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/util/frankensteinMigrate.ts
@@ -0,0 +1,9 @@
+import {migration as locksToFreezesMigration} from '../migrations/942057-appPromotion';
+export interface Migration {
+ before: () => Promise<void>,
+ after: () => Promise<void>,
+}
+
+export const migrations: {[key: string]: Migration} = {
+ 'v942057': locksToFreezesMigration,
+};