diff --git a/Makefile b/Makefile index 65183a997..b4738a373 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS)) update \ test \ $(TOOLS) \ - clean_eth2_network_simulation_files \ + clean_eth2_network_simulation_all \ eth2_network_simulation \ clean-testnet0 \ testnet0 \ @@ -132,10 +132,13 @@ $(TOOLS): | build deps echo -e $(BUILD_MSG) "build/$@" && \ $(ENV_SCRIPT) nim c -o:build/$@ $(NIM_PARAMS) "$${TOOL_DIR}/$@.nim" -clean_eth2_network_simulation_files: +clean_eth2_network_simulation_data: + rm -rf tests/simulation/{data} + +clean_eth2_network_simulation_all: rm -rf tests/simulation/{data,validators} -eth2_network_simulation: | build deps clean_eth2_network_simulation_files +eth2_network_simulation: | build deps clean_eth2_network_simulation_data + GIT_ROOT="$$PWD" NIMFLAGS="$(NIMFLAGS)" LOG_LEVEL="$(LOG_LEVEL)" tests/simulation/start-in-tmux.sh clean-testnet0: diff --git a/README.md b/README.md index ebd381cc5..4a8603ab5 100644 --- a/README.md +++ b/README.md @@ -191,7 +191,20 @@ make VALIDATORS=192 NODES=6 USER_NODES=1 eth2_network_simulation # looks like from a single nodes' perspective. ``` -By default all validators are loaded within the beacon nodes, but if you want to use external processes as validator clients you can pass `BN_VC_VALIDATOR_SPLIT=yes` as an additional argument to the `make eth2_network_simulation` command and that will split the `VALIDATORS` between beacon nodes and validator clients - for example with `192` validators and `6` nodes you will end up with 6 beacon node and 6 validator client processes, where each of them will handle 16 validators. +By default, all validators are loaded within the beacon nodes, but if you want to use +external processes as validator clients you can pass `BN_VC_VALIDATOR_SPLIT=yes` as an +additional argument to the `make eth2_network_simulation` command and that will split +the `VALIDATORS` between beacon nodes and validator clients - for example with `192` +validators and `6` nodes you will end up with 6 beacon node and 6 validator client +processes, where each of them will handle 16 validators. + +By default, the simulation will start from a pre-generated genesis state. If you wish to +simulate the bootstrap process with a Ethereum 1.0 validator deposit contract, start the +simulation with `WAIT_GENESIS=yes` + +``` +make eth2_network_simulation WAIT_GENESIS=yes +``` You can also separate the output from each beacon node in its own panel, using [multitail](http://www.vanheusden.com/multitail/): diff --git a/tests/simulation/start-in-tmux.sh b/tests/simulation/start-in-tmux.sh index 8a6510fff..68590e4a5 100755 --- a/tests/simulation/start-in-tmux.sh +++ b/tests/simulation/start-in-tmux.sh @@ -6,7 +6,14 @@ cd "$(dirname "$0")" TMUX_CMD="${TMUX_CMD:-tmux}" USE_TMUX="${USE_TMUX:-yes}" -type "$TMUX_CMD" &>/dev/null || { echo "${TMUX_CMD}" is missing; USE_TMUX="no"; } + +if [[ "$USE_MULTITAIL" == "yes" ]]; then + USE_TMUX="no" +fi + +if [[ "$USE_TMUX" != "no" ]]; then + type "$TMUX_CMD" &>/dev/null || { echo "${TMUX_CMD}" is missing; USE_TMUX="no"; } +fi if [[ "$USE_TMUX" != "no" ]]; then TMUX_SESSION_NAME="${TMUX_SESSION_NAME:-nbc-sim}" @@ -31,10 +38,6 @@ if [[ "$USE_TMUX" != "no" ]]; then $TMUX_CMD new-window -t "${TMUX_SESSION_NAME}" -n "start-script" "$PWD/start.sh" $TMUX_CMD select-window -t "${TMUX_SESSION_NAME}:start-script" - #$TMUX_CMD send-keys -t "${TMUX_SESSION_NAME}:0" "$PWD/start.sh" Enter - #$TMUX_CMD select-window -t "${TMUX_SESSION_NAME}:0" - # $TMUX_CMD attach-session -t "${TMUX_SESSION_NAME}" - $TMUX_CMD attach-session -t "${TMUX_SESSION_NAME}" else ./start.sh diff --git a/tests/simulation/start.sh b/tests/simulation/start.sh index 53f6d7c8a..4e83b4822 100755 --- a/tests/simulation/start.sh +++ b/tests/simulation/start.sh @@ -129,7 +129,7 @@ if [ ! -f "${SNAPSHOT_FILE}" ]; then --output-bootstrap-file="${NETWORK_BOOTSTRAP_FILE}" \ --bootstrap-address=127.0.0.1 \ --bootstrap-port=$(( BASE_P2P_PORT + MASTER_NODE )) \ - --genesis-offset=45 # Delay in seconds + --genesis-offset=15 # Delay in seconds fi fi @@ -139,6 +139,7 @@ function run_cmd { bin_name=$3 if [[ "$USE_TMUX" == "yes" ]]; then echo "Starting node $i..." + $TMUX_CMD select-window -t "${TMUX_SESSION_NAME}:sim" $TMUX_CMD split-window -t "${TMUX_SESSION_NAME}" "$CMD" $TMUX_CMD select-layout -t "${TMUX_SESSION_NAME}:sim" tiled elif [[ "$USE_MULTITAIL" != "no" ]]; then