Makefile: testnet targets wrapping connect_to_testnet.sh

- also moved the binary into the "build" directory
This commit is contained in:
Ștefan Talpalaru 2019-03-28 23:19:12 +01:00
parent 1633ccaaca
commit 819992a786
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
2 changed files with 29 additions and 7 deletions

View File

@ -43,6 +43,22 @@ clean_eth2_network_simulation_files:
eth2_network_simulation: | beacon_node validator_keygen clean_eth2_network_simulation_files
SKIP_BUILDS=1 GIT_ROOT="$$PWD" BUILD_OUTPUTS_DIR="./build" tests/simulation/start.sh
clean-testnet0:
rm -rf ~/.cache/nimbus/BeaconNode/testnet0
testnet0-nocleaning: | build deps
../../env.sh scripts/connect_to_testnet.sh testnet0
testnet0: | clean-testnet0 testnet0-nocleaning
clean-testnet1:
rm -rf ~/.cache/nimbus/BeaconNode/testnet1
testnet1-nocleaning: | build deps
../../env.sh scripts/connect_to_testnet.sh testnet1
testnet1: | clean-testnet1 testnet1-nocleaning
clean:
rm -rf build/{$(TOOLS_CSV),all_tests,*.exe} nimcache

View File

@ -1,22 +1,28 @@
#!/bin/bash
[ -z "$1" ] && { echo "Usage: `basename $0` testnetX"; exit 1; }
set -eu
cd $(dirname "$0")
NETWORK_NAME=$1
NETWORK_NAME="$1"
source "$NETWORK_NAME.env"
cd ..
NIM_FLAGS="-d:release --lineTrace:on -d:chronicles_log_level=DEBUG -d:SECONDS_PER_SLOT=$SECONDS_PER_SLOT -d:SHARD_COUNT=$SHARD_COUNT -d:SLOTS_PER_EPOCH=$SLOTS_PER_EPOCH"
NIM_FLAGS="-d:release --lineTrace:on -d:chronicles_log_level=DEBUG -d:SECONDS_PER_SLOT=$SECONDS_PER_SLOT -d:SHARD_COUNT=$SHARD_COUNT -d:SLOTS_PER_EPOCH=$SLOTS_PER_EPOCH --hints:off --verbosity:0"
BEACON_NODE_BIN=${NETWORK_NAME}_node
BEACON_NODE_BIN="build/${NETWORK_NAME}_node"
nim c $NIM_FLAGS -o:"./$BEACON_NODE_BIN" beacon_chain/beacon_node
CMD="nim c $NIM_FLAGS -o:$BEACON_NODE_BIN beacon_chain/beacon_node"
echo "$CMD"
$CMD
if [ ! -d ~/.cache/nimbus/BeaconNode/$NETWORK_NAME/validators ]; then
./$BEACON_NODE_BIN --network=$NETWORK_NAME importValidator
if [ ! -d ~/.cache/nimbus/BeaconNode/${NETWORK_NAME}/validators ]; then
$BEACON_NODE_BIN --network=$NETWORK_NAME importValidator
fi
./$BEACON_NODE_BIN --network=$NETWORK_NAME --tcpPort:$BOOTSTRAP_PORT --udpPort:$BOOTSTRAP_PORT
$BEACON_NODE_BIN --network=$NETWORK_NAME --tcpPort:$BOOTSTRAP_PORT --udpPort:$BOOTSTRAP_PORT