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.tsdiffbeforeafterboth--- 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 {
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,
+};