--- 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 --- a/tests/src/util/frankenstein.ts +++ b/tests/src/util/frankenstein.ts @@ -20,6 +20,7 @@ import {readNetworkConfig} from '@zombienet/utils/dist'; import {resolve} from 'path'; import {usingPlaygrounds} from '.'; +import {migrations} from './frankensteinMigrate'; import fs from 'fs'; const ZOMBIENET_CREDENTIALS = process.env.ZOMBIENET_CREDENTIALS || '../.env'; @@ -245,12 +246,14 @@ await waitWithTimer(relayInfo.epochTime); } + const migration = migrations[process.env.DESTINATION_SPEC_VERSION!]; for(const paraId in network.paras) { console.log(`\n--- Upgrading the runtime of parachain ${paraId} \t---`); const para = network.paras[paraId]; // Enable maintenance mode if present await toggleMaintenanceMode(true, para.nodes[0].wsUri); + if(migration) await migration.before(); // Read the WASM code and authorize the upgrade with its hash and set it as the new runtime const code = fs.readFileSync(NEW_PARA_WASM); @@ -324,6 +327,8 @@ // Disable maintenance mode if present for(const paraId in network.paras) { + // TODO only if our parachain + if(migration) await migration.after(); await toggleMaintenanceMode(false, network.paras[paraId].nodes[0].wsUri); } } else { --- /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, + after: () => Promise, +} + +export const migrations: {[key: string]: Migration} = { + 'v942057': locksToFreezesMigration, +};