Skip to content

Commit

Permalink
add script for manual migration
Browse files Browse the repository at this point in the history
use westend
fix README
  • Loading branch information
Maksandre committed Jun 12, 2023
1 parent f747618 commit 9773e5a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RUST_TOOLCHAIN=nightly-2022-11-15
POLKADOT_LAUNCH_BRANCH=unique-network
RELAY_CHAIN_TYPE=rococo
RELAY_CHAIN_TYPE=westend
CHAINQL=v0.4.1
DESTINATION_SPEC_VERSION=v942057

Expand Down
10 changes: 6 additions & 4 deletions tests/src/migrations/942057-appPromotion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ cargo install chainql

## Execute offchain migration

To run, you need to add an environment variable (`SUPERUSER_SEED`) with the sudo key seed.
To run, you need to set an environment variables:
- `SUPERUSER_SEED` – the sudo key seed.
- `WS_RPC` – the network address

Run the script by executing the following command:
Run the migration by executing the following command:

```sh
npx ts-node --esm lockedToFreeze.ts
```
npx ts-node --esm executeMigration.ts
```
4 changes: 1 addition & 3 deletions tests/src/migrations/942057-appPromotion/collectData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {exec, execSync} from 'child_process';
import {exec} from 'child_process';
import path from 'path';
import {dirname} from 'path';
import {fileURLToPath} from 'url';
Expand All @@ -8,7 +8,5 @@ export const collectData = () => {

const pathToScript = path.resolve(dirName, './stakersParser.jsonnet');
const outputPath = path.resolve(dirName, './output.json');
// execSync(`chainql --tla-str=chainUrl=wss://ws-quartz.unique.network:443 ${pathToScript} > ${outputPath}`);
// execSync(`chainql --tla-str=chainUrl=ws://127.0.0.1:9944 ${pathToScript} > ${outputPath}`);
exec(`chainql --tla-str=chainUrl=ws://127.0.0.1:9944 ${pathToScript} > ${outputPath}`);
};
11 changes: 11 additions & 0 deletions tests/src/migrations/942057-appPromotion/executeMigration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {migrateLockedToFreeze} from './lockedToFreeze';


const WS_RPC = process.env.WS_RPC || 'wss://ws-opal.unique.network:443';
const SUPERUSER_SEED = process.env.SUPERUSER_SEED || '';

migrateLockedToFreeze({
wsEndpoint: WS_RPC,
donorSeed: SUPERUSER_SEED,
})
.catch(console.error);
2 changes: 0 additions & 2 deletions tests/src/util/frankenstein.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,7 @@ const raiseZombienet = async (): Promise<void> => {
// Enable maintenance mode if present
await toggleMaintenanceMode(true, para.nodes[0].wsUri);
if(migration) {
console.log('⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️');
console.log('⭐️⭐️⭐️ Running pre-upgrade scripts... ⭐️⭐️⭐️');
console.log('⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️');
await migration.before();
}

Expand Down

0 comments on commit 9773e5a

Please sign in to comment.