2019-09-01 15:02:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2019-09-27 16:17:03 +00:00
|
|
|
VALIDATORS_START=${1:-20}
|
|
|
|
VALIDATORS_NUM=${2:-5}
|
2019-10-08 17:03:00 +00:00
|
|
|
VALIDATORS_TOTAL=${3:-30}
|
2019-09-27 16:17:03 +00:00
|
|
|
|
|
|
|
source "$(dirname "$0")/vars.sh"
|
|
|
|
|
2019-09-01 15:02:49 +00:00
|
|
|
cd "$GIT_ROOT"
|
|
|
|
|
2019-09-10 21:55:58 +00:00
|
|
|
DATA_DIR="${SIMULATION_DIR}/node-0"
|
2019-09-01 15:02:49 +00:00
|
|
|
|
2019-09-10 21:55:58 +00:00
|
|
|
V_PREFIX="${VALIDATORS_DIR}/v$(printf '%06d' 0)"
|
|
|
|
PORT=$(printf '5%04d' 0)
|
2019-09-01 15:02:49 +00:00
|
|
|
|
|
|
|
NAT_FLAG="--nat:none"
|
|
|
|
if [ "${NAT:-}" == "1" ]; then
|
|
|
|
NAT_FLAG="--nat:any"
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $DATA_DIR/validators
|
|
|
|
rm -f $DATA_DIR/validators/*
|
|
|
|
|
2019-09-05 10:19:08 +00:00
|
|
|
pushd $VALIDATORS_DIR >/dev/null
|
2019-09-27 16:17:03 +00:00
|
|
|
cp $(seq -s " " -f v%07g.privkey $VALIDATORS_START $(($VALIDATORS_START+$VALIDATORS_NUM-1))) $DATA_DIR/validators
|
2019-09-05 10:19:08 +00:00
|
|
|
popd >/dev/null
|
2019-09-01 15:02:49 +00:00
|
|
|
|
2019-09-27 16:17:03 +00:00
|
|
|
rm -rf "$DATA_DIR/dump"
|
|
|
|
mkdir -p "$DATA_DIR/dump"
|
|
|
|
|
|
|
|
set -x
|
|
|
|
trap 'kill -9 -- -$$' SIGINT EXIT SIGTERM
|
|
|
|
|
|
|
|
./env.sh $BEACON_NODE_BIN \
|
2019-10-28 23:04:52 +00:00
|
|
|
--status-bar:off \
|
|
|
|
--data-dir:$DATA_DIR \
|
|
|
|
--node-name:0 \
|
|
|
|
--tcp-port:$PORT \
|
|
|
|
--udp-port:$PORT \
|
2019-09-01 15:02:49 +00:00
|
|
|
$NAT_FLAG \
|
2019-10-28 23:04:52 +00:00
|
|
|
--state-snapshot:$SNAPSHOT_FILE
|