diff --git a/Makefile b/Makefile index 3391da3ab..1f1aaaa79 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/scripts/connect_to_testnet.sh b/scripts/connect_to_testnet.sh index 3acf7320e..b8acf4158 100755 --- a/scripts/connect_to_testnet.sh +++ b/scripts/connect_to_testnet.sh @@ -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