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
|
|
|
|
2019-10-03 01:51:44 +00:00
|
|
|
NODE_ID=${1}
|
|
|
|
shift
|
|
|
|
|
2019-09-05 10:55:47 +00:00
|
|
|
source "$(dirname "$0")/vars.sh"
|
2019-03-28 15:18:59 +00:00
|
|
|
cd "$GIT_ROOT"
|
2019-02-28 21:21:29 +00:00
|
|
|
|
2019-10-03 01:51:44 +00:00
|
|
|
DATA_DIR="${SIMULATION_DIR}/node-$NODE_ID"
|
2019-02-28 21:21:29 +00:00
|
|
|
|
2019-10-03 01:51:44 +00:00
|
|
|
V_PREFIX="${VALIDATORS_DIR}/v$(printf '%06d' $NODE_ID)"
|
|
|
|
PORT=$(printf '5%04d' $NODE_ID)
|
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-10-03 01:51:44 +00:00
|
|
|
FIRST_VALIDATOR_IDX=$(( (NUM_VALIDATORS / ($NUM_NODES + $NUM_MISSING_NODES)) * $NODE_ID ))
|
|
|
|
LAST_VALIDATOR_IDX=$(( (NUM_VALIDATORS / ($NUM_NODES + $NUM_MISSING_NODES)) * ($NODE_ID + 1) - 1 ))
|
2019-03-28 22:36:39 +00:00
|
|
|
|
|
|
|
mkdir -p $DATA_DIR/validators
|
|
|
|
rm -f $DATA_DIR/validators/*
|
2019-05-14 13:31:19 +00:00
|
|
|
|
2019-09-05 10:55:47 +00:00
|
|
|
pushd $VALIDATORS_DIR >/dev/null
|
2019-05-14 13:31:19 +00:00
|
|
|
cp $(seq -s " " -f v%07g.privkey $FIRST_VALIDATOR_IDX $LAST_VALIDATOR_IDX) $DATA_DIR/validators
|
2019-09-05 10:55:47 +00:00
|
|
|
popd >/dev/null
|
2019-03-28 22:36:39 +00:00
|
|
|
|
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-10-03 01:51:44 +00:00
|
|
|
--nodename:$NODE_ID \
|
2019-03-07 13:59:28 +00:00
|
|
|
--tcpPort:$PORT \
|
|
|
|
--udpPort:$PORT \
|
2019-03-19 18:57:57 +00:00
|
|
|
$NAT_FLAG \
|
2019-07-12 14:24:11 +00:00
|
|
|
--stateSnapshot:$SNAPSHOT_FILE \
|
2019-07-18 11:36:53 +00:00
|
|
|
$DEPOSIT_WEB3_URL_ARG \
|
2019-10-03 01:51:44 +00:00
|
|
|
--depositContractAddress=$DEPOSIT_CONTRACT_ADDRESS \
|
2019-10-17 13:18:58 +00:00
|
|
|
--metricsServer=true \
|
|
|
|
--metricsServerAddress="127.0.0.1" \
|
2019-10-28 13:28:45 +00:00
|
|
|
--metricsServerPort="$(( $BASE_METRICS_PORT + $NODE_ID ))" \
|
2019-10-17 13:18:58 +00:00
|
|
|
"$@"
|
2019-10-03 01:51:44 +00:00
|
|
|
|