mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-22 20:42:13 +00:00
Allow mixing daemon and native libp2p builds in local sim
This commit is contained in:
parent
84c238ca8b
commit
81f031ea1b
@ -47,7 +47,12 @@ fi
|
||||
rm -rf "$DATA_DIR/dump"
|
||||
mkdir -p "$DATA_DIR/dump"
|
||||
|
||||
$BEACON_NODE_BIN \
|
||||
NODE_BIN=$BEACON_NODE_BIN
|
||||
if [[ $NODE_ID == $MASTER_NODE ]]; then
|
||||
NODE_BIN=$BOOTSTRAP_NODE_BIN
|
||||
fi
|
||||
|
||||
$NODE_BIN \
|
||||
--bootstrap-file=$BOOTSTRAP_ADDRESS_FILE \
|
||||
--data-dir=$DATA_DIR \
|
||||
--node-name=$NODE_ID \
|
||||
|
@ -28,8 +28,22 @@ 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"
|
||||
|
||||
echo "Building $BEACON_NODE_BIN ($DEFS)"
|
||||
nim c -o:"$BEACON_NODE_BIN" $NIMFLAGS $DEFS beacon_chain/beacon_node
|
||||
build_beacon_node () {
|
||||
OUTPUT_BIN=$1; shift
|
||||
PARAMS="$NIMFLAGS $DEFS $*"
|
||||
echo "Building $OUTPUT_BIN ($PARAMS)"
|
||||
nim c -o:$OUTPUT_BIN $PARAMS beacon_chain/beacon_node
|
||||
}
|
||||
|
||||
build_beacon_node $BEACON_NODE_BIN -d:"NETWORK_TYPE=$NETWORK_TYPE"
|
||||
|
||||
if [[ "$BOOTSTRAP_NODE_NETWORK_TYPE" != "$NETWORK_TYPE" ]]; then
|
||||
build_beacon_node $BOOTSTRAP_NODE_BIN \
|
||||
--nimcache:nimcache/bootstrap_node \
|
||||
-d:"NETWORK_TYPE=$BOOTSTRAP_NODE_NETWORK_TYPE"
|
||||
else
|
||||
cp -l $BEACON_NODE_BIN $BOOTSTRAP_NODE_BIN
|
||||
fi
|
||||
|
||||
if [ ! -f "${LAST_VALIDATOR}" ]; then
|
||||
echo Building $DEPLOY_DEPOSIT_CONTRACT_BIN
|
||||
@ -112,8 +126,10 @@ COMMANDS=()
|
||||
|
||||
if [[ "$USE_TMUX" != "no" ]]; then
|
||||
$TMUX new-session -s $TMUX_SESSION_NAME -d
|
||||
|
||||
# maybe these should be moved to a user config file
|
||||
$TMUX set-option -t $TMUX_SESSION_NAME history-limit 999999
|
||||
$TMUX set-option -t $TMUX_SESSION_NAME remain-on-exit on
|
||||
$TMUX set -t $TMUX_SESSION_NAME mouse on
|
||||
fi
|
||||
|
||||
@ -128,7 +144,7 @@ for i in $(seq $MASTER_NODE -1 $TOTAL_USER_NODES); do
|
||||
CMD="${SIM_ROOT}/run_node.sh $i"
|
||||
|
||||
if [[ "$USE_TMUX" != "no" ]]; then
|
||||
$TMUX split-window -t $TMUX_SESSION_NAME "$CMD; pause"
|
||||
$TMUX split-window -t $TMUX_SESSION_NAME "$CMD"
|
||||
$TMUX select-layout -t $TMUX_SESSION_NAME tiled
|
||||
elif [[ "$USE_MULTITAIL" != "no" ]]; then
|
||||
if [[ "$i" == "$MASTER_NODE" ]]; then
|
||||
|
@ -25,12 +25,18 @@ TOTAL_USER_NODES=${USER_NODES:-0}
|
||||
TOTAL_SYSTEM_NODES=$(( TOTAL_NODES - TOTAL_USER_NODES ))
|
||||
MASTER_NODE=$(( TOTAL_NODES - 1 ))
|
||||
|
||||
# You can run a mixed simulation of daemon and native libp2p nodes
|
||||
# by changing the variables below:
|
||||
NETWORK_TYPE=libp2p
|
||||
BOOTSTRAP_NODE_NETWORK_TYPE=libp2p
|
||||
|
||||
SIMULATION_DIR="${SIM_ROOT}/data"
|
||||
METRICS_DIR="${SIM_ROOT}/prometheus"
|
||||
VALIDATORS_DIR="${SIM_ROOT}/validators"
|
||||
SNAPSHOT_FILE="${SIMULATION_DIR}/state_snapshot.ssz"
|
||||
NETWORK_BOOTSTRAP_FILE="${SIMULATION_DIR}/bootstrap_nodes.txt"
|
||||
BEACON_NODE_BIN="${SIMULATION_DIR}/beacon_node"
|
||||
BOOTSTRAP_NODE_BIN="${SIMULATION_DIR}/bootstrap_node"
|
||||
DEPLOY_DEPOSIT_CONTRACT_BIN="${SIMULATION_DIR}/deploy_deposit_contract"
|
||||
MASTER_NODE_ADDRESS_FILE="${SIMULATION_DIR}/node-${MASTER_NODE}/beacon_node.address"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user