From 956843822fc5c4f092b0a428a82e699f0af2c1b4 Mon Sep 17 00:00:00 2001 From: jonny rhea Date: Tue, 8 Oct 2019 12:03:00 -0500 Subject: [PATCH] Added run_artemis.sh script --- multinet/.gitignore | 1 + multinet/run_all.sh | 4 +- multinet/run_artemis.sh | 79 ++++++++++++++++++++++++++++++++++++++ multinet/run_lighthouse.sh | 2 +- multinet/run_lodestar.sh | 2 +- multinet/run_nimbus.sh | 2 +- multinet/run_prysm.sh | 2 +- multinet/run_trinity.sh | 2 +- 8 files changed, 88 insertions(+), 6 deletions(-) create mode 100755 multinet/run_artemis.sh diff --git a/multinet/.gitignore b/multinet/.gitignore index 43788342f..5ca8efd76 100644 --- a/multinet/.gitignore +++ b/multinet/.gitignore @@ -4,3 +4,4 @@ validators trinity prysm lodestar +artemis diff --git a/multinet/run_all.sh b/multinet/run_all.sh index c23051767..b998b0a0a 100755 --- a/multinet/run_all.sh +++ b/multinet/run_all.sh @@ -15,6 +15,7 @@ if [ "$USE_MULTITAIL" != "no" ]; then COMMANDS+=( " -cT ansi -t 'lighthouse' -l 'sleep 3; ./run_lighthouse.sh 5 5; echo [node execution completed]; while true; do sleep 100; done'" ) COMMANDS+=( " -cT ansi -t 'prysm' -l 'sleep 3; ./run_prysm.sh 15 5; echo [node execution completed]; while true; do sleep 100; done'" ) COMMANDS+=( " -cT ansi -t 'lodestar' -l 'sleep 3; ./run_lodestar.sh 20 5; echo [node execution completed]; while true; do sleep 100; done'" ) + COMMANDS+=( " -cT ansi -t 'artemis' -l 'sleep 3; ./run_artemis.sh 25 5; echo [node execution completed]; while true; do sleep 100; done'" ) eval $MULTITAIL -s 3 -M 0 -x \"Multichain\" "${COMMANDS[@]}" else trap 'kill -9 -- -$$' SIGINT EXIT SIGTERM @@ -24,6 +25,7 @@ else ./run_trinity.sh & ./run_lighthouse.sh & ./run_prysm.sh & - ./run_lodestar.sh & + ./run_lodestar & + ./run_artemis.sh & wait fi diff --git a/multinet/run_artemis.sh b/multinet/run_artemis.sh new file mode 100755 index 000000000..210cee87b --- /dev/null +++ b/multinet/run_artemis.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +# https://github.com/PegaSysEng/artemis#build-instructions + +set -eu + +VALIDATORS_START=${1:-0} +VALIDATORS_NUM=${2:-5} +VALIDATORS_TOTAL=${3:-25} + +SRCDIR=${ARTEMIS_PATH:-"artemis"} +CWD=`pwd` +echo $CWD + +print_java_install_msg() { + + MSG+="OpenJDK 11 is missing. Please install it " + if [[ "$OSTYPE" == "linux-gnu" ]]; then + MSG+=" with 'sudo apt install openjdk-11-jdk'" + elif [[ "$OSTYPE" == "darwin"* ]]; then + MSG+=" with 'brew tap AdoptOpenJDK/openjdk && brew cask install adoptopenjdk11'" + fi + echo MSG; +} + +# Is Java installed? +if ! command -v java; then + print_java_install_msg; + exit 1; +fi + +# Is openjdk-11-jdk installed? +if [[ $(java -version 2>&1) != *"OpenJDK"* ]]; then + print_java_install_msg; + exit 1; +fi + +command -v gradle > /dev/null || { echo "install gradle (https://gradle.org/install/)"; exit 1; } + +[[ -d "$SRCDIR" ]] || { + bash <(curl -s https://raw.githubusercontent.com/PegaSysEng/artemis/master/scripts/clone-repo.sh) + pushd "$SRCDIR" + ./gradlew distTar installDist + popd +} + +if command -v jq > /dev/null; then + GENESIS_TIME=$(jq '.genesis_time' data/state_snapshot.json) +else + GENESIS_TIME=$(grep '"genesis_time"' data/state_snapshot.json | grep -o '[0-9]*,' | sed 's/.$//') +fi + +pushd "$SRCDIR" + +NUM_NODES=1 +GENESIS_FILE="$CWD/data/state_snapshot.ssz" + +sh scripts/configurator.sh "config/config.toml" networkMode "\"jvmlibp2p"\" +sh scripts/configurator.sh "config/config.toml" numValidators $VALIDATORS_TOTAL +sh scripts/configurator.sh "config/config.toml" numNodes $NUM_NODES +sh scripts/configurator.sh "config/config.toml" active true +sh scripts/configurator.sh "config/config.toml" genesisTime $GENESIS_TIME +sh scripts/configurator.sh "config/config.toml" ownedValidatorStartIndex $VALIDATORS_START +sh scripts/configurator.sh "config/config.toml" ownedValidatorCount $VALIDATORS_NUM +sh scripts/configurator.sh "config/config.toml" startState "\"$GENESIS_FILE"\" + +PEERS="$(cat ../data/bootstrap_nodes.txt)" +ARTEMIS_PEERS=$(echo [\"$PEERS\"] ) +sed -i.bak 's/bootnodes/peers/g' config/config.toml +rm -f config/config.toml.bak +sh scripts/configurator.sh "config/config.toml" peers $ARTEMIS_PEERS +sh scripts/configurator.sh "config/config.toml" discovery "\"static\"" +sh scripts/configurator.sh "config/config.toml" isBootnode false +cp config/config.toml build/install/artemis/bin/ +popd + +set -x + +cd "$SRCDIR/build/install/artemis/bin/" && ./artemis --config=config.toml --logging=DEBUG; diff --git a/multinet/run_lighthouse.sh b/multinet/run_lighthouse.sh index e409f15d9..a052cd78a 100755 --- a/multinet/run_lighthouse.sh +++ b/multinet/run_lighthouse.sh @@ -6,7 +6,7 @@ set -eu VALIDATORS_START=${1:-0} VALIDATORS_NUM=${2:-5} -VALIDATORS_TOTAL=${3:-25} +VALIDATORS_TOTAL=${3:-30} SRCDIR=${LIGHTHOUSE_PATH:-"lighthouse"} diff --git a/multinet/run_lodestar.sh b/multinet/run_lodestar.sh index bd3635b21..d0c631b07 100755 --- a/multinet/run_lodestar.sh +++ b/multinet/run_lodestar.sh @@ -4,7 +4,7 @@ set -eu VALIDATORS_START=${1:-5} VALIDATORS_NUM=${2:-5} -VALIDATORS_TOTAL=${3:-25} +VALIDATORS_TOTAL=${3:-30} SRCDIR=${LODESTAR_PATH:-"lodestar"} diff --git a/multinet/run_nimbus.sh b/multinet/run_nimbus.sh index 6831ddea7..dbcbfb3c4 100755 --- a/multinet/run_nimbus.sh +++ b/multinet/run_nimbus.sh @@ -4,7 +4,7 @@ set -eu VALIDATORS_START=${1:-20} VALIDATORS_NUM=${2:-5} -VALIDATORS_TOTAL=${3:-25} +VALIDATORS_TOTAL=${3:-30} source "$(dirname "$0")/vars.sh" diff --git a/multinet/run_prysm.sh b/multinet/run_prysm.sh index 8278070f5..e7979230b 100755 --- a/multinet/run_prysm.sh +++ b/multinet/run_prysm.sh @@ -5,7 +5,7 @@ trap 'kill -9 -- -$$' SIGINT EXIT SIGTERM VALIDATORS_START=${1:-15} VALIDATORS_NUM=${2:-5} -VALIDATORS_TOTAL=${3:-25} +VALIDATORS_TOTAL=${3:-30} SRCDIR=${PRYSM_PATH:-"prysm"} diff --git a/multinet/run_trinity.sh b/multinet/run_trinity.sh index 2dc3da9d1..f1afe7b6a 100755 --- a/multinet/run_trinity.sh +++ b/multinet/run_trinity.sh @@ -4,7 +4,7 @@ set -eu VALIDATORS_START=${1:-10} VALIDATORS_NUM=${2:-5} -VALIDATORS_TOTAL=${3:-25} +VALIDATORS_TOTAL=${3:-30} SRCDIR=${TRINITY_PATH:-"trinity"}