@@ -15,94 +15,86 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
15
15
# The base directory of the subtensor project
16
16
BASE_DIR=" $SCRIPT_DIR /.."
17
17
18
- # Get parameters
18
+ # get parameters
19
+ # Get the value of fast_blocks from the first argument
19
20
fast_blocks=${1:- " True" }
20
- testnet=${2:- " Fale" }
21
-
22
- # Initialize FEATURES
23
- FEATURES=" pow-faucet runtime-benchmarks"
24
21
25
22
# Check the value of fast_blocks
26
- if [ " $fast_blocks " == " True" ]; then
27
- echo " fast_blocks is On"
28
- FEATURES+=" fast-blocks"
29
- else
30
- echo " fast_blocks is Off"
31
- fi
32
-
33
- # Check the value of testnet
34
- if [ " $testnet " == " True" ]; then
35
- echo " testnet is On"
36
- FEATURES+=" testnet"
23
+ if [ " $fast_blocks " == " False" ]; then
24
+ # Block of code to execute if fast_blocks is False
25
+ echo " fast_blocks is Off"
26
+ : " ${CHAIN:= local} "
27
+ : " ${BUILD_BINARY:= 1} "
28
+ : " ${FEATURES:= " pow-faucet runtime-benchmarks" } "
37
29
else
38
- echo " testnet is Off"
30
+ # Block of code to execute if fast_blocks is not False
31
+ echo " fast_blocks is On"
32
+ : " ${CHAIN:= local} "
33
+ : " ${BUILD_BINARY:= 1} "
34
+ : " ${FEATURES:= " pow-faucet runtime-benchmarks fast-blocks" } "
39
35
fi
40
36
41
- : " ${CHAIN:= local} "
42
- : " ${BUILD_BINARY:= 1} "
43
-
44
37
SPEC_PATH=" ${SCRIPT_DIR} /specs/"
45
38
FULL_PATH=" $SPEC_PATH$CHAIN .json"
46
39
47
-
48
40
# Kill any existing nodes which may have not exited correctly after a previous
49
41
# run.
50
42
pkill -9 ' node-subtensor'
51
43
52
44
if [ ! -d " $SPEC_PATH " ]; then
53
- echo " *** Creating directory ${SPEC_PATH} ..."
54
- mkdir $SPEC_PATH
45
+ echo " *** Creating directory ${SPEC_PATH} ..."
46
+ mkdir $SPEC_PATH
55
47
fi
56
48
57
49
if [[ $BUILD_BINARY == " 1" ]]; then
58
- echo " *** Building substrate binary..."
59
- cargo build --workspace --profile=release --features " $FEATURES " --manifest-path " $BASE_DIR /Cargo.toml"
60
- echo " *** Binary compiled"
50
+ echo " *** Building substrate binary..."
51
+ cargo build --workspace --profile=release --features " $FEATURES " --manifest-path " $BASE_DIR /Cargo.toml"
52
+ echo " *** Binary compiled"
61
53
fi
62
54
63
55
echo " *** Building chainspec..."
64
56
" $BASE_DIR /target/release/node-subtensor" build-spec --disable-default-bootnode --raw --chain $CHAIN > $FULL_PATH
65
57
echo " *** Chainspec built and output to file"
66
58
67
59
if [ $NO_PURGE -eq 1 ]; then
68
- echo " *** Purging previous state skipped..."
60
+ echo " *** Purging previous state skipped..."
69
61
else
70
- echo " *** Purging previous state..."
71
- " $BASE_DIR /target/release/node-subtensor" purge-chain -y --base-path /tmp/bob --chain=" $FULL_PATH " > /dev/null 2>&1
72
- " $BASE_DIR /target/release/node-subtensor" purge-chain -y --base-path /tmp/alice --chain=" $FULL_PATH " > /dev/null 2>&1
73
- echo " *** Previous chainstate purged"
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"
74
66
fi
75
67
76
68
echo " *** Starting localnet nodes..."
77
69
alice_start=(
78
- " $BASE_DIR /target/release/node-subtensor"
79
- --base-path /tmp/alice
80
- --chain=" $FULL_PATH "
81
- --alice
82
- --port 30334
83
- --rpc-port 9946
84
- --validator
85
- --rpc-cors=all
86
- --allow-private-ipv4
87
- --discover-local
70
+ " $BASE_DIR /target/release/node-subtensor"
71
+ --base-path /tmp/alice
72
+ --chain=" $FULL_PATH "
73
+ --alice
74
+ --port 30334
75
+ --rpc-port 9946
76
+ --validator
77
+ --rpc-cors=all
78
+ --allow-private-ipv4
79
+ --discover-local
88
80
)
89
81
90
82
bob_start=(
91
- " $BASE_DIR " /target/release/node-subtensor
92
- --base-path /tmp/bob
93
- --chain=" $FULL_PATH "
94
- --bob
95
- --port 30335
96
- --rpc-port 9945
97
- --validator
98
- --allow-private-ipv4
99
- --discover-local
83
+ " $BASE_DIR " /target/release/node-subtensor
84
+ --base-path /tmp/bob
85
+ --chain=" $FULL_PATH "
86
+ --bob
87
+ --port 30335
88
+ --rpc-port 9945
89
+ --validator
90
+ --allow-private-ipv4
91
+ --discover-local
100
92
)
101
93
102
94
trap ' pkill -P $$' EXIT SIGINT SIGTERM
103
95
104
96
(
105
- (" ${alice_start[@]} " 2>&1 ) &
106
- (" ${bob_start[@]} " 2>&1 )
107
- wait
97
+ (" ${alice_start[@]} " 2>&1 ) &
98
+ (" ${bob_start[@]} " 2>&1 )
99
+ wait
108
100
)
0 commit comments