#!/bin/bash set -eo pipefail # Read in variables # shellcheck source=/dev/null source "$(dirname "$0")/vars.sh" cd "$SIM_ROOT" mkdir -p "$SIMULATION_DIR" mkdir -p "$VALIDATORS_DIR" cd "$GIT_ROOT" CUSTOM_NIMFLAGS="${NIMFLAGS} -d:useSysAsserts -d:chronicles_sinks:textlines,json[file] -d:const_preset=mainnet" # Run with "SLOTS_PER_EPOCH=8 ./start.sh" to change these DEFS="" DEFS+="-d:MAX_COMMITTEES_PER_SLOT=${MAX_COMMITTEES_PER_SLOT:-1} " # Spec default: 64 DEFS+="-d:SLOTS_PER_EPOCH=${SLOTS_PER_EPOCH:-6} " # Spec default: 32 DEFS+="-d:SECONDS_PER_SLOT=${SECONDS_PER_SLOT:-6} " # Spec default: 12 LAST_VALIDATOR_NUM=$(( NUM_VALIDATORS - 1 )) LAST_VALIDATOR="$VALIDATORS_DIR/v$(printf '%07d' $LAST_VALIDATOR_NUM).deposit.json" # Windows detection if uname | grep -qiE "mingw|msys"; then MAKE="mingw32-make" EXE_SUFFIX=".exe" else MAKE="make" EXE_SUFFIX="" fi # to allow overriding the program names MULTITAIL="${MULTITAIL:-multitail}" TMUX="${TMUX:-tmux}" GANACHE="${GANACHE:-ganache-cli}" PROMETHEUS="${PROMETHEUS:-prometheus}" TMUX_SESSION_NAME="${TMUX_SESSION_NAME:-nbc-sim}" WAIT_GENESIS="${WAIT_GENESIS:-no}" # Using tmux or multitail is an opt-in USE_MULTITAIL="${USE_MULTITAIL:-no}" type "$MULTITAIL" &>/dev/null || { echo "${MULTITAIL}" is missing; USE_MULTITAIL="no"; } USE_TMUX="${USE_TMUX:-no}" type "$TMUX" &>/dev/null || { echo "${TMUX}" is missing; USE_TMUX="no"; } USE_GANACHE="${USE_GANACHE:-no}" type "$GANACHE" &>/dev/null || { echo $GANACHE is missing; USE_GANACHE="no"; } USE_PROMETHEUS="${LAUNCH_PROMETHEUS:-no}" type "$PROMETHEUS" &>/dev/null || { echo $PROMETHEUS is missing; USE_PROMETHEUS="no"; } # Prometheus config (continued inside the loop) mkdir -p "${METRICS_DIR}" cat > "${METRICS_DIR}/prometheus.yml" <> "${METRICS_DIR}/prometheus.yml" <