123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #!/usr/bin/env bash
- set -e
- SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
- cd $SCRIPT_PATH
- TARGET_RUNTIME_TAG=${TARGET_RUNTIME_TAG:=$(../../scripts/runtime-code-shasum.sh)}
- RUNTIME_TAG=${RUNTIME_TAG:=sumer}
- POST_MIGRATION_ASYNC_ASSERTIONS=${POST_MIGRATION_ASYNC_ASSERTIONS:=$true}
- source ./node-utils.sh
- function fork_off_init() {
-
- if ! [[ -f ${DATA_PATH}/storage.json ]]; then
- curl http://testnet-rpc-3-uk.joystream.org:9933 -H \
- "Content-type: application/json" -d \
- '{"jsonrpc":"2.0","id":1,"method":"state_getPairs","params":["0x"]}' \
- > ${DATA_PATH}/storage.json
- fi
- if ! [[ -f ${DATA_PATH}/schema.json ]]; then
- cp $SCRIPT_PATH/../../types/augment/all/defs.json ${DATA_PATH}/schema.json
- fi
- id=$(docker create joystream/node:${TARGET_RUNTIME_TAG})
- docker cp $id:/joystream/runtime.compact.wasm ${DATA_PATH}/runtime.wasm
-
- WS_RPC_ENDPOINT="wss://testnet-rpc-3-uk.joystream.org" \
- yarn workspace api-scripts tsnode-strict src/fork-off.ts
- }
- function export_chainspec_file_to_disk() {
- echo "**** Initializing node database by exporting state ****"
-
- docker-compose -f ../../docker-compose.yml run \
- -v ${DATA_PATH}:/spec joystream-node export-state \
- --chain /spec/chain-spec-raw.json \
- --base-path /data --pruning archive > ${DATA_PATH}/exported-state.json
- }
- function main {
- CONTAINER_ID=""
- echo "**** CREATING EMPTY CHAINSPEC ****"
- create_initial_config
- create_chainspec_file
- convert_chainspec
- echo "**** EMPTY CHAINSPEC CREATED SUCCESSFULLY ****"
-
- fork_off_init
- export JOYSTREAM_NODE_TAG=$RUNTIME_TAG
-
- export_chainspec_file_to_disk
- echo "***** STARTING NODE WITH FORKED STATE *****"
- CONTAINER_ID=$(start_node)
- if ( $POST_MIGRATION_ASYNC_ASSERTIONS ); then
- sleep 120
-
- echo "***** POST MIGRATION TYPESCRIPT *****"
- yarn workspace network-tests node-ts-strict src/scenarios/post-migration.ts
- fi
- }
- main || :
- cleanup
|