Add a script to export testnet state
This commit is contained in:
parent
daad25a049
commit
b3ebd32499
28
scripts/export-testnet-state.sh
Executable file
28
scripts/export-testnet-state.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Note: Needs to be run in a docker container with image testnet cerc/laconicd:local
|
||||||
|
|
||||||
|
# Exit on error
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
# Check args
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: $0 <testnet-deployment-dir-absolute>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TESTNET_DEPLOYMENT_DIR="$1"
|
||||||
|
|
||||||
|
# Create a temporary target directory
|
||||||
|
OUTPUT_DIR=${TESTNET_DEPLOYMENT_DIR}/export
|
||||||
|
mkdir -p $OUTPUT_DIR
|
||||||
|
|
||||||
|
# Export state from testnet chain
|
||||||
|
testnet_state_file="$OUTPUT_DIR/testnet-state.json"
|
||||||
|
docker run -it \
|
||||||
|
-v ${TESTNET_DEPLOYMENT_DIR}/data/laconicd-data:/root/testnet-deployment/.laconicd \
|
||||||
|
cerc/laconicd:local bash -c "laconicd export --home /root/testnet-deployment/.laconicd" \
|
||||||
|
| jq .app_state.onboarding > "$testnet_state_file"
|
||||||
|
|
||||||
|
echo "Exported state from testnet to $testnet_state_file"
|
@ -6,11 +6,11 @@ set -u
|
|||||||
|
|
||||||
# Check args
|
# Check args
|
||||||
if [ "$#" -ne 1 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
echo "Usage: $0 <testnet-deployment-dir-absolute>"
|
echo "Usage: $0 <testnet-state-json-file-path>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TESTNET_DEPLOYMENT_DIR="$1"
|
TESTNET_STATE_FILE="$1"
|
||||||
MAINNET_GENESIS_DIR=mainnet-genesis
|
MAINNET_GENESIS_DIR=mainnet-genesis
|
||||||
|
|
||||||
# Create a temporary target directory
|
# Create a temporary target directory
|
||||||
@ -18,16 +18,8 @@ mkdir -p $MAINNET_GENESIS_DIR
|
|||||||
|
|
||||||
# --------
|
# --------
|
||||||
|
|
||||||
# Export state from testnet chain
|
# Copy testnet state file to required dir
|
||||||
# Use cerc/laconicd-testnet:local image for testnet laconicd build
|
cp $TESTNET_STATE_FILE $MAINNET_GENESIS_DIR/testnet-state.json
|
||||||
|
|
||||||
testnet_state_file="$MAINNET_GENESIS_DIR/testnet-state.json"
|
|
||||||
docker run -it \
|
|
||||||
-v ${TESTNET_DEPLOYMENT_DIR}/data/laconicd-data:/root/testnet-deployment/.laconicd \
|
|
||||||
cerc/laconicd-testnet:local bash -c "laconicd export --home /root/testnet-deployment/.laconicd" \
|
|
||||||
| jq .app_state.onboarding > "$testnet_state_file"
|
|
||||||
|
|
||||||
echo "Exported state from testnet"
|
|
||||||
|
|
||||||
# --------
|
# --------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user