Merge the latest multinet scripts from the interop branch
This commit is contained in:
parent
1555efd9d8
commit
ff0281c9db
|
@ -1,3 +1,6 @@
|
|||
data
|
||||
lighthouse
|
||||
validators
|
||||
trinity
|
||||
prysm
|
||||
lodestar
|
||||
|
|
|
@ -6,7 +6,7 @@ In general, follow the build instructions of `nim-beacon-chain` as documented in
|
|||
|
||||
### Prerequisites
|
||||
|
||||
:warning: To build nimbus, you need to have `rocksdb` and `pcre` installed - see [../](main repo) for instructions.
|
||||
:warning: To build nimbus, you need to have the `go` compiler (for go-libp2p-daemon), `rocksdb` and `pcre` installed - see [../](main repo) for instructions.
|
||||
|
||||
```bash
|
||||
# Clone repo
|
||||
|
@ -38,6 +38,9 @@ cd multinet
|
|||
# Or do all in one step, with multitail
|
||||
USE_MULTITAIL=1 ./run_all.sh
|
||||
|
||||
# The client scripts take optional arguments:
|
||||
# ./script.sh <start_validator_num> <number_of_validators> <total_validators>
|
||||
./run_nimbus.sh 0 20 40 # run nimbus with 20 validators, starting from 0, on a 40-validator network
|
||||
```
|
||||
|
||||
## Diagnostics
|
||||
|
|
|
@ -49,7 +49,7 @@ if [ ! -f "${SNAPSHOT_FILE}" ]; then
|
|||
--outputBootstrapNodes="${SIMULATION_DIR}/bootstrap_nodes.txt" \
|
||||
--bootstrapAddress=127.0.0.1 \
|
||||
--bootstrapPort=50000 \
|
||||
--genesisOffset=10 # Delay in seconds
|
||||
--genesisOffset=30 # Delay in seconds
|
||||
fi
|
||||
|
||||
# Delete any leftover address files from a previous session
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Kill child processes on Ctrl-C by sending SIGTERM to the whole process group,
|
||||
# passing the negative PID of this shell instance to the "kill" command.
|
||||
# Trap and ignore SIGTERM, so we don't kill this process along with its children.
|
||||
trap '' SIGTERM
|
||||
trap 'kill -- -$$' SIGINT EXIT
|
||||
|
||||
./make_genesis.sh
|
||||
|
||||
# multitail support
|
||||
|
@ -13,25 +7,23 @@ MULTITAIL="${MULTITAIL:-multitail}" # to allow overriding the program name
|
|||
USE_MULTITAIL="${USE_MULTITAIL:-no}" # make it an opt-in
|
||||
type "$MULTITAIL" &>/dev/null || USE_MULTITAIL="no"
|
||||
|
||||
# Kill child processes on Ctrl-C by sending SIGTERM to the whole process group,
|
||||
# passing the negative PID of this shell instance to the "kill" command.
|
||||
# Trap and ignore SIGTERM, so we don't kill this process along with its children.
|
||||
if [ "$USE_MULTITAIL" = "no" ]; then
|
||||
trap '' SIGTERM
|
||||
trap 'kill -- -$$' SIGINT EXIT
|
||||
fi
|
||||
|
||||
if [ "$USE_MULTITAIL" != "no" ]; then
|
||||
COMMANDS=()
|
||||
# "multitail" closes the corresponding panel when a command exits, so let's make sure it doesn't exit
|
||||
COMMANDS+=( " -cT ansi -t 'nimbus' -l './run_nimbus.sh 0; echo [node execution completed]; while true; do sleep 100; done'" )
|
||||
COMMANDS+=( " -cT ansi -t 'trinity' -l 'sleep 3; ./run_trinity.sh; echo [node execution completed]; while true; do sleep 100; done'" )
|
||||
COMMANDS+=( " -cT ansi -t 'lighthouse' -l 'sleep 3; ./run_lighthouse.sh; echo [node execution completed]; while true; do sleep 100; done'" )
|
||||
COMMANDS+=( " -cT ansi -t 'prysm' -l 'sleep 3; ./run_prysm.sh; echo [node execution completed]; while true; do sleep 100; done'" )
|
||||
COMMANDS+=( " -cT ansi -t 'lodestar' -l 'sleep 3; ./run_lodestar.sh; 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
|
||||
|
||||
./run_nimbus.sh 0 &
|
||||
sleep 2
|
||||
./run_trinity.sh &
|
||||
./run_lighthouse.sh &
|
||||
./run_prysm.sh &
|
||||
./run_lodestar.sh &
|
||||
wait
|
||||
fi
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Helper script for running a lighthouse node and connecting to the beacon node
|
||||
# that's set up by start.sh
|
||||
|
||||
# https://github.com/sigp/lighthouse/blob/master/docs/interop.md
|
||||
|
||||
set -eu
|
||||
|
||||
VALIDATORS_START=${1:-0}
|
||||
VALIDATORS_NUM=${2:-5}
|
||||
VALIDATORS_TOTAL=${3:-25}
|
||||
|
||||
SRCDIR=${LIGHTHOUSE_PATH:-"lighthouse"}
|
||||
|
||||
echo Locating protoc...
|
||||
if ! command -v protoc; then
|
||||
MSG="protoc (the Google Protobuf compiler) is missing. Please install it manually"
|
||||
|
@ -34,38 +37,39 @@ if ! command -v protoc; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
cargo_path=$(which cargo)
|
||||
[[ -x "$cargo_path" ]] || { echo "install rust first (https://rust-lang.org)"; exit 1; }
|
||||
command -v cargo > /dev/null || { echo "install rust first (https://rust-lang.org)"; exit 1; }
|
||||
|
||||
LIGHTHOUSE=${LIGHTHOSE_PATH:-"lighthouse"}
|
||||
|
||||
[[ -d "$LIGHTHOUSE" ]] || {
|
||||
git clone https://github.com/sigp/lighthouse.git "$LIGHTHOUSE"
|
||||
pushd "$LIGHTHOUSE"
|
||||
[[ -d "$SRCDIR" ]] || {
|
||||
git clone https://github.com/sigp/lighthouse.git "$SRCDIR"
|
||||
pushd "$SRCDIR"
|
||||
git checkout interop # temporary interop branch - will get merged soon I expect!
|
||||
cargo update
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
pushd "$LIGHTHOUSE"
|
||||
pushd "$SRCDIR"
|
||||
cargo build --release
|
||||
popd
|
||||
|
||||
# Fetch genesis time, as set up by start.sh
|
||||
if command -v jq; then
|
||||
genesis_time=$(jq '.genesis_time' data/state_snapshot.json)
|
||||
if command -v jq > /dev/null; then
|
||||
GENESIS_TIME=$(jq '.genesis_time' data/state_snapshot.json)
|
||||
else
|
||||
genesis_time=$(grep -oP '(?<=genesis_time": )\w+(?=,)' data/state_snapshot.json)
|
||||
GENESIS_TIME=$(grep -oP '(?<=genesis_time": )\w+(?=,)' data/state_snapshot.json)
|
||||
fi
|
||||
|
||||
echo Genesis time was $genesis_time
|
||||
echo Genesis time was $GENESIS_TIME
|
||||
|
||||
cd "$LIGHTHOUSE/target/release"
|
||||
set -x
|
||||
trap 'kill -9 -- -$$' SIGINT EXIT SIGTERM
|
||||
|
||||
cd "$SRCDIR/target/release"
|
||||
|
||||
#$export RUST_LOG=libp2p=trace,multistream=trace,gossipsub=trace
|
||||
|
||||
# fresh start!
|
||||
rm -rf ~/.lighthouse
|
||||
|
||||
./beacon_node --libp2p-addresses="/ip4/127.0.0.1/tcp/50000" testnet --spec minimal quick 16 $genesis_time
|
||||
./beacon_node --libp2p-addresses="$(cat ../data/bootstrap_nodes.txt)" testnet --spec minimal quick $VALIDATORS_TOTAL $GENESIS_TIME &
|
||||
|
||||
./validator_client testnet -b insecure $VALIDATORS_START $VALIDATORS_NUM
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
VALIDATORS_START=${1:-5}
|
||||
VALIDATORS_NUM=${2:-5}
|
||||
VALIDATORS_TOTAL=${3:-25}
|
||||
|
||||
SRCDIR=${LODESTAR_PATH:-"lodestar"}
|
||||
|
||||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
|
||||
command -v nvm > /dev/null || { echo "install nvm first (https://github.com/nvm-sh/nvm#installation-and-update)"; exit 1; }
|
||||
|
||||
# Install node 10 LTS
|
||||
echo Switching to node 10..
|
||||
nvm install 10 && nvm use 10
|
||||
|
||||
[[ -d "$SRCDIR" ]] || {
|
||||
git clone git@github.com:ChainSafe/lodestar.git "$SRCDIR"
|
||||
|
||||
pushd "$SRCDIR"
|
||||
|
||||
command -v yarn > /dev/null || { npm install --global yarn ; }
|
||||
|
||||
yarn install
|
||||
npx lerna bootstrap
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
set -x
|
||||
trap 'kill -9 -- -$$' SIGINT EXIT SIGTERM
|
||||
|
||||
cd "$SRCDIR/packages/lodestar"
|
||||
|
||||
# Start
|
||||
# -v is optional
|
||||
./bin/lodestar interop -p minimal --db l1 \
|
||||
-q ../../../data/state_snapshot.ssz \
|
||||
--multiaddrs "$(cat ../../../data/bootstrap_nodes.txt)" \
|
||||
-r -v $VALIDATORS_START,$(($VALIDATORS_START+$VALIDATORS_NUM))
|
|
@ -2,7 +2,12 @@
|
|||
|
||||
set -eu
|
||||
|
||||
. $(dirname $0)/vars.sh
|
||||
VALIDATORS_START=${1:-20}
|
||||
VALIDATORS_NUM=${2:-5}
|
||||
VALIDATORS_TOTAL=${3:-25}
|
||||
|
||||
source "$(dirname "$0")/vars.sh"
|
||||
|
||||
cd "$GIT_ROOT"
|
||||
|
||||
DATA_DIR="${SIMULATION_DIR}/node-0"
|
||||
|
@ -15,17 +20,20 @@ if [ "${NAT:-}" == "1" ]; then
|
|||
NAT_FLAG="--nat:any"
|
||||
fi
|
||||
|
||||
FIRST_VALIDATOR_IDX=$(( (NUM_VALIDATORS / ($NUM_NODES + $NUM_MISSING_NODES)) * $1 ))
|
||||
LAST_VALIDATOR_IDX=$(( (NUM_VALIDATORS / ($NUM_NODES + $NUM_MISSING_NODES)) * ($1 + 1) - 1 ))
|
||||
|
||||
mkdir -p $DATA_DIR/validators
|
||||
rm -f $DATA_DIR/validators/*
|
||||
|
||||
pushd $VALIDATORS_DIR >/dev/null
|
||||
cp $(seq -s " " -f v%07g.privkey $FIRST_VALIDATOR_IDX $LAST_VALIDATOR_IDX) $DATA_DIR/validators
|
||||
cp $(seq -s " " -f v%07g.privkey $VALIDATORS_START $(($VALIDATORS_START+$VALIDATORS_NUM-1))) $DATA_DIR/validators
|
||||
popd >/dev/null
|
||||
|
||||
$BEACON_NODE_BIN \
|
||||
rm -rf "$DATA_DIR/dump"
|
||||
mkdir -p "$DATA_DIR/dump"
|
||||
|
||||
set -x
|
||||
trap 'kill -9 -- -$$' SIGINT EXIT SIGTERM
|
||||
|
||||
./env.sh $BEACON_NODE_BIN \
|
||||
--network:$NETWORK_METADATA_FILE \
|
||||
--dataDir:$DATA_DIR \
|
||||
--nodename:0 \
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
trap 'kill -9 -- -$$' SIGINT EXIT SIGTERM
|
||||
|
||||
VALIDATORS_START=${1:-15}
|
||||
VALIDATORS_NUM=${2:-5}
|
||||
VALIDATORS_TOTAL=${3:-25}
|
||||
|
||||
SRCDIR=${PRYSM_PATH:-"prysm"}
|
||||
|
||||
command -v bazel > /dev/null || { echo "install bazel build tool first (https://docs.bazel.build/versions/master/install.html)"; exit 1; }
|
||||
command -v go > /dev/null || { echo "install go first (https://golang.org/doc/install)"; exit 1; }
|
||||
|
||||
# This script assumes amd64. Prysm builds for other architectures, but keeping it simple
|
||||
# for this start script.
|
||||
OS=""
|
||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||||
OS+="linux_amd64"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
OS+="darwin_amd64"
|
||||
else
|
||||
# Windows builds do work, but it would make this script more complicated.
|
||||
# Allowing for Mac and Linux only for the moment.
|
||||
echo "Only Mac and Linux builds supported at this time"
|
||||
fi
|
||||
|
||||
[[ -d "$SRCDIR" ]] || {
|
||||
git clone git@github.com:prysmaticlabs/prysm.git "$SRCDIR"
|
||||
pushd "$SRCDIR"
|
||||
bazel build --define ssz=minimal //beacon-chain //validator
|
||||
popd
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
cd "$SRCDIR"
|
||||
|
||||
"$(bazel info bazel-bin)/beacon-chain/${OS}_stripped/beacon-chain" \
|
||||
--datadir /tmp/beacon \
|
||||
--pprof --verbosity=debug \
|
||||
--clear-db \
|
||||
--bootstrap-node= \
|
||||
--peer=$(cat ../data/bootstrap_nodes.txt) \
|
||||
--interop-eth1data-votes \
|
||||
--deposit-contract=0xD775140349E6A5D12524C6ccc3d6A1d4519D4029 \
|
||||
--interop-genesis-state ../data/state_snapshot.ssz &
|
||||
|
||||
sleep 3
|
||||
|
||||
"$(bazel info bazel-bin)/validator/${OS}_pure_stripped/validator" \
|
||||
--interop-start-index=$VALIDATORS_START \
|
||||
--interop-num-validators=$VALIDATORS_NUM
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
VALIDATORS_START=${1:-10}
|
||||
VALIDATORS_NUM=${2:-5}
|
||||
VALIDATORS_TOTAL=${3:-25}
|
||||
|
||||
SRCDIR=${TRINITY_PATH:-"trinity"}
|
||||
|
||||
command -v python3 > /dev/null || { echo "install python3 first (https://wiki.python.org/moin/BeginnersGuide/Download)"; exit 1; }
|
||||
|
||||
[[ -d "$SRCDIR" ]] || {
|
||||
git clone git@github.com:ethereum/trinity.git "$SRCDIR"
|
||||
pushd "$SRCDIR"
|
||||
|
||||
git checkout interop # temporary interop branch - will get merged soon I expect!
|
||||
|
||||
python3 -m venv _ve
|
||||
|
||||
. _ve/bin/activate
|
||||
|
||||
pip install -e .[eth2-dev]
|
||||
popd
|
||||
}
|
||||
|
||||
set -x
|
||||
trap 'kill -9 -- -$$' SIGINT EXIT SIGTERM
|
||||
|
||||
cd "$SRCDIR"
|
||||
|
||||
. _ve/bin/activate
|
||||
|
||||
rm -rf /tmp/bb
|
||||
|
||||
VALIDATORS=$(seq $VALIDATORS_START $(($VALIDATORS_START+$VALIDATORS_NUM-1)) | paste -d ',' -s -)
|
||||
|
||||
PYTHONWARNINGS=ignore::DeprecationWarning trinity-beacon \
|
||||
-l DEBUG \
|
||||
--trinity-root-dir /tmp/bb \
|
||||
--beacon-nodekey='aaaaaaaa' \
|
||||
--preferred_nodes="$(cat ../data/bootstrap_nodes.txt)" \
|
||||
interop \
|
||||
--validators $VALIDATORS \
|
||||
--genesis-state-ssz-path ../data/state_snapshot.ssz
|
|
@ -13,9 +13,9 @@ cd $(git rev-parse --show-toplevel)
|
|||
: ${GIT_ROOT:="$($PWD_CMD)"}
|
||||
cd - &>/dev/null
|
||||
|
||||
NUM_VALIDATORS=${VALIDATORS:-16}
|
||||
NUM_NODES=${NODES:-3}
|
||||
NUM_MISSING_NODES=${MISSING_NODES:-1}
|
||||
NUM_VALIDATORS=${VALIDATORS:-25}
|
||||
NUM_NODES=${NODES:-1}
|
||||
NUM_MISSING_NODES=${MISSING_NODES:-2}
|
||||
|
||||
SIMULATION_DIR="${SIM_ROOT}/data"
|
||||
VALIDATORS_DIR="${SIM_ROOT}/validators"
|
||||
|
|
Loading…
Reference in New Issue