Added run_artemis.sh script

This commit is contained in:
jonny rhea 2019-10-08 12:03:00 -05:00 committed by Zahary Karadjov
parent 5f271fd82e
commit 956843822f
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
8 changed files with 88 additions and 6 deletions

1
multinet/.gitignore vendored
View File

@ -4,3 +4,4 @@ validators
trinity
prysm
lodestar
artemis

View File

@ -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

79
multinet/run_artemis.sh Executable file
View File

@ -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;

View File

@ -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"}

View File

@ -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"}

View File

@ -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"

View File

@ -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"}

View File

@ -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"}