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
--- 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
modifiedtests/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 {
addedtests/src/util/frankensteinMigrate.tsdiffbeforeafterboth

no content