beacon node wrapper script

Bonus: `make NIMFLAGS="--stackTrace:on" testnet1` now works as expected
This commit is contained in:
Ștefan Talpalaru 2019-07-11 13:52:59 +02:00
parent d554374409
commit 44af08cc86
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
3 changed files with 20 additions and 5 deletions

3
.gitignore vendored
View File

@ -9,3 +9,6 @@ build/
*.la
*.exe
*.dll
/scripts/testnet*.sh

View File

@ -54,7 +54,7 @@ eth2_network_simulation: | beacon_node validator_keygen clean_eth2_network_simul
SKIP_BUILDS=1 GIT_ROOT="$$PWD" BUILD_OUTPUTS_DIR="./build" tests/simulation/start.sh
testnet0 testnet1: | build deps nat-libs p2pd
../../env.sh scripts/build_testnet_node.sh $@
NIM_PARAMS="$(NIM_PARAMS)" ../../env.sh scripts/build_testnet_node.sh $@
clean-testnet0:
rm -rf ~/.cache/nimbus/BeaconNode/testnet0

View File

@ -3,7 +3,7 @@
[ -z "$1" ] && { echo "Usage: `basename $0` testnetX"; exit 1; }
set -eu
set -e
cd $(dirname "$0")
@ -12,11 +12,13 @@ source "$NETWORK_NAME.env"
cd ..
NIM_FLAGS="-d:release --lineTrace:on -d:chronicles_log_level=DEBUG -d:network_type=$NETWORK_TYPE -d:SECONDS_PER_SLOT=$SECONDS_PER_SLOT -d:SHARD_COUNT=$SHARD_COUNT -d:SLOTS_PER_EPOCH=$SLOTS_PER_EPOCH -d:DEFAULT_NETWORK=$NETWORK_NAME --hints:off --verbosity:0"
# the NIM_PARAMS env var will be set in the Makefile, based on NIMFLAGS passed on the `make` command line
# (i.e.: make NIMFLAGS="--stackTrace:on" testnet1).
OUR_NIM_FLAGS="-d:release --lineTrace:on -d:chronicles_log_level=DEBUG -d:network_type=$NETWORK_TYPE -d:SECONDS_PER_SLOT=$SECONDS_PER_SLOT -d:SHARD_COUNT=$SHARD_COUNT -d:SLOTS_PER_EPOCH=$SLOTS_PER_EPOCH -d:DEFAULT_NETWORK=$NETWORK_NAME $NIM_PARAMS"
BEACON_NODE_BIN="build/${NETWORK_NAME}_node"
CMD="nim c $NIM_FLAGS -o:$BEACON_NODE_BIN beacon_chain/beacon_node"
CMD="nim c $OUR_NIM_FLAGS -o:$BEACON_NODE_BIN beacon_chain/beacon_node"
echo "$CMD"
$CMD
@ -24,10 +26,20 @@ if [ ! -d ~/.cache/nimbus/BeaconNode/${NETWORK_NAME}/validators ]; then
$BEACON_NODE_BIN --network=$NETWORK_NAME importValidator
fi
# simple wrapper script
BEACON_NODE_SCRIPT="scripts/${NETWORK_NAME}.sh"
cat > "$BEACON_NODE_SCRIPT" <<EOF
#!/bin/bash
cd \$(dirname "\$0")/..
../../env.sh $BEACON_NODE_BIN "\$@"
EOF
chmod 755 "$BEACON_NODE_SCRIPT"
echo
echo "Done! You're now ready to connect to $NETWORK_NAME by running:"
echo
echo " ../../env.sh $BEACON_NODE_BIN"
echo " $BEACON_NODE_SCRIPT"
echo
echo "Database and configuration files will be placed in:"
echo