Browse Source

data_path now environment variable + minor fixes

ignazio 3 years ago
parent
commit
f9aa5b3ad1

+ 4 - 4
tests/network-tests/node-utils.sh

@@ -12,7 +12,7 @@ cd $SCRIPT_PATH
 
 # Location that will be mounted as the /data volume in containers
 # This is where the initial members and balances files and generated chainspec files will be located.
-DATA_PATH=${DATA_PATH:=$(pwd)/data}
+export DATA_PATH=${DATA_PATH:=$(pwd)/data}
 mkdir -p ${DATA_PATH}
 
 # Initial account balance for sudo account
@@ -115,9 +115,9 @@ function convert_chainspec {
 #   None
 #######################################
 function cleanup() {
-    if [[ -z $CONTAINER_ID ]]; then
-	docker logs ${CONTAINER_ID} --tail 15
-    fi
+    # if [[ -z $CONTAINER_ID ]]; then
+    # 	docker logs ${CONTAINER_ID} --tail 15
+    # fi
     docker-compose -f ../../docker-compose.yml down -v
     find ./assets/ -name '[A-Z0-9]*__rejectedContent.json' -delete
 }

+ 4 - 2
tests/network-tests/run-migration-tests.sh

@@ -116,14 +116,16 @@ source ./.env
 #######################################
 function fork_off_init() {
     # chain-spec-raw already existing
+
+    WS_RPC_ENDPOINT="wss://testnet-rpc-3-uk.joystream.org"
     
     if ! [[ -f "$(pwd)/storage.json" ]]; then
 	scp ignazio@testnet-rpc-3-uk.joystream.org:/home/ignazio/storage.json ./storage.json
 	cp ./storage.json ${DATA_PATH}/storage.json
     fi
-    
+
     if ! [[ -f ${DATA_PATH}/schema.json ]]; then
-	cp ../../types/augment/all/defs.json \
+	cp $(pwd)/../../types/augment/all/defs.json \
 	     ${DATA_PATH}/schema.json
     fi
 

+ 4 - 9
utils/api-scripts/src/fork-off.ts

@@ -6,7 +6,6 @@ const execSync = require('child_process').execSync;
 
 // paths & env variables
 let alice = process.env.SUDO_ACCOUNT
-
 // bad error handling TODO: fix process.env
 let schemaPath = path.join(process.env.DATA_PATH || "", 'schema.json');
 let wasmPath = path.join(process.env.DATA_PATH || "", 'runtime.wasm') || "";
@@ -34,7 +33,7 @@ const skippedModulesPrefix = ['System', 'Session', 'Babe', 'Grandpa', 'GrandpaFi
 
 async function fixParachinStates(api: ApiPromise, chainSpec: any) {
     const skippedKeys = [
-        api.query.parasScheduler.sessionStartBlock.key()
+        api.query["parasScheduler"].sessionStartBlock.key()
     ];
     for (const k of skippedKeys) {
         delete chainSpec.genesis.raw.top[k];
@@ -62,11 +61,11 @@ async function main() {
 
     let metadata = await api.rpc.state.getMetadata();
     // Populate the prefixes array
-    let modules: Array<Module> = metadata.asLatest.pallets;
+    let modules = metadata.asLatest.modules;
     modules.forEach((module) => {
         if (module.storage) {
-            if (!skippedModulesPrefix.includes(module.name)) {
-                prefixes.push(xxhashAsHex(module.name, 128));
+            if (!skippedModulesPrefix.includes(module.name.toString())) {
+                prefixes.push(xxhashAsHex(module.name.toString(), 128));
             }
         }
     });
@@ -119,7 +118,3 @@ interface Storage {
     "id": string,
 }
 
-interface Module {
-    "name": string,
-    "storage": string,
-}