2019-02-28 21:21:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-03-28 15:18:59 +00:00
|
|
|
set -eu
|
2019-02-28 21:21:29 +00:00
|
|
|
|
|
|
|
. $(dirname $0)/vars.sh
|
2019-03-28 15:18:59 +00:00
|
|
|
cd "$GIT_ROOT"
|
2019-02-28 21:21:29 +00:00
|
|
|
|
2019-03-28 15:18:59 +00:00
|
|
|
DATA_DIR="${SIMULATION_DIR}/node-${1}"
|
2019-02-28 21:21:29 +00:00
|
|
|
|
2019-03-28 15:18:59 +00:00
|
|
|
V_PREFIX="${VALIDATORS_DIR}/v$(printf '%06d' ${1})"
|
2019-03-07 13:59:28 +00:00
|
|
|
PORT=$(printf '5%04d' ${1})
|
2019-03-19 18:57:57 +00:00
|
|
|
|
2019-04-18 00:02:14 +00:00
|
|
|
NAT_FLAG="--nat:none"
|
2019-03-19 18:57:57 +00:00
|
|
|
if [ "${NAT:-}" == "1" ]; then
|
2019-04-18 00:02:14 +00:00
|
|
|
NAT_FLAG="--nat:any"
|
2019-03-19 18:57:57 +00:00
|
|
|
fi
|
2019-03-07 13:59:28 +00:00
|
|
|
|
2019-03-28 23:42:45 +00:00
|
|
|
FIRST_VALIDATOR_IDX=$(printf '%07d' $(( (NUM_VALIDATORS / ($NUM_NODES + $NUM_MISSING_NODES)) * $1 )))
|
|
|
|
LAST_VALIDATOR_IDX=$(printf '%07d' $(( (NUM_VALIDATORS / ($NUM_NODES + $NUM_MISSING_NODES)) * ($1 + 1) - 1 )))
|
2019-03-28 22:36:39 +00:00
|
|
|
|
|
|
|
mkdir -p $DATA_DIR/validators
|
|
|
|
rm -f $DATA_DIR/validators/*
|
|
|
|
eval cp ${VALIDATORS_DIR}/v{$FIRST_VALIDATOR_IDX..$LAST_VALIDATOR_IDX}.privkey $DATA_DIR/validators
|
|
|
|
|
2019-02-28 21:21:29 +00:00
|
|
|
$BEACON_NODE_BIN \
|
2019-03-19 17:22:17 +00:00
|
|
|
--network:$NETWORK_METADATA_FILE \
|
2019-02-28 21:21:29 +00:00
|
|
|
--dataDir:$DATA_DIR \
|
2019-03-22 14:35:20 +00:00
|
|
|
--nodename:${1} \
|
2019-03-07 13:59:28 +00:00
|
|
|
--tcpPort:$PORT \
|
|
|
|
--udpPort:$PORT \
|
2019-03-19 18:57:57 +00:00
|
|
|
$NAT_FLAG \
|
2019-03-19 17:22:17 +00:00
|
|
|
--stateSnapshot:$SNAPSHOT_FILE
|