Skip to content

Commit a03ce30

Browse files
Merge pull request #675 from opentensor/feat/roman/no-purge-flag
Added `--no-purge` flag to `scripts/localnet.sh` to be able to save state when restarting a script.
2 parents 5b5f500 + 7b04c49 commit a03ce30

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
141141
// `spec_version`, and `authoring_version` are the same between Wasm and native.
142142
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
143143
// the compatible custom types.
144-
spec_version: 191,
144+
spec_version: 192,
145145
impl_version: 1,
146146
apis: RUNTIME_API_VERSIONS,
147147
transaction_version: 1,

scripts/localnet.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#!/bin/bash
22

3+
# Check if `--no-purge` passed as a parameter
4+
NO_PURGE=0
5+
for arg in "$@"; do
6+
if [ "$arg" = "--no-purge" ]; then
7+
NO_PURGE=1
8+
break
9+
fi
10+
done
11+
312
# Determine the directory this script resides in. This allows invoking it from any location.
413
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
514

@@ -47,10 +56,14 @@ echo "*** Building chainspec..."
4756
"$BASE_DIR/target/release/node-subtensor" build-spec --disable-default-bootnode --raw --chain $CHAIN >$FULL_PATH
4857
echo "*** Chainspec built and output to file"
4958

50-
echo "*** Purging previous state..."
51-
"$BASE_DIR/target/release/node-subtensor" purge-chain -y --base-path /tmp/bob --chain="$FULL_PATH" >/dev/null 2>&1
52-
"$BASE_DIR/target/release/node-subtensor" purge-chain -y --base-path /tmp/alice --chain="$FULL_PATH" >/dev/null 2>&1
53-
echo "*** Previous chainstate purged"
59+
if [ $NO_PURGE -eq 1 ]; then
60+
echo "*** Purging previous state skipped..."
61+
else
62+
echo "*** Purging previous state..."
63+
"$BASE_DIR/target/release/node-subtensor" purge-chain -y --base-path /tmp/bob --chain="$FULL_PATH" >/dev/null 2>&1
64+
"$BASE_DIR/target/release/node-subtensor" purge-chain -y --base-path /tmp/alice --chain="$FULL_PATH" >/dev/null 2>&1
65+
echo "*** Previous chainstate purged"
66+
fi
5467

5568
echo "*** Starting localnet nodes..."
5669
alice_start=(

0 commit comments

Comments
 (0)