difftreelog
add before and after hooks to frankenstein
in: master
3 files changed
.envdiffbeforeafterboth2POLKADOT_LAUNCH_BRANCH=unique-network2POLKADOT_LAUNCH_BRANCH=unique-network3RELAY_CHAIN_TYPE=westend3RELAY_CHAIN_TYPE=westend4CHAINQL=v0.4.14CHAINQL=v0.4.15DESTINATION_SPEC_VERSION=v942057566POLKADOT_MAINNET_BRANCH=release-v0.9.377POLKADOT_MAINNET_BRANCH=release-v0.9.377STATEMINT_BUILD_BRANCH=release-parachains-v93708STATEMINT_BUILD_BRANCH=release-parachains-v9370tests/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.tsdiffbeforeafterbothno changes