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

difftreelog

add before and after hooks to frankenstein

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

3 files changed

modified.envdiffbeforeafterboth
2POLKADOT_LAUNCH_BRANCH=unique-network2POLKADOT_LAUNCH_BRANCH=unique-network
3RELAY_CHAIN_TYPE=westend3RELAY_CHAIN_TYPE=westend
4CHAINQL=v0.4.14CHAINQL=v0.4.1
5DESTINATION_SPEC_VERSION=v942057
56
6POLKADOT_MAINNET_BRANCH=release-v0.9.377POLKADOT_MAINNET_BRANCH=release-v0.9.37
7STATEMINT_BUILD_BRANCH=release-parachains-v93708STATEMINT_BUILD_BRANCH=release-parachains-v9370
modifiedtests/src/util/frankenstein.tsdiffbeforeafterboth
20import {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';
2425
25const 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 }
247248
249 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];
251253
252 // Enable maintenance mode if present254 // Enable maintenance mode if present
253 await toggleMaintenanceMode(true, para.nodes[0].wsUri);255 await toggleMaintenanceMode(true, para.nodes[0].wsUri);
256 if(migration) await migration.before();
254257
255 // 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 runtime
256 const code = fs.readFileSync(NEW_PARA_WASM);259 const code = fs.readFileSync(NEW_PARA_WASM);
324327
325 // Disable maintenance mode if present328 // Disable maintenance mode if present
326 for(const paraId in network.paras) {329 for(const paraId in network.paras) {
330 // TODO only if our parachain
331 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 {
addedtests/src/util/frankensteinMigrate.tsdiffbeforeafterboth

no changes