improve tests/simulation/start.sh and friends [skip ci]

This commit is contained in:
Ștefan Talpalaru 2019-09-05 12:55:47 +02:00
parent b6f4fa5532
commit 33a9370c99
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
3 changed files with 12 additions and 9 deletions

View File

@ -76,7 +76,7 @@ clean_eth2_network_simulation_files:
rm -rf tests/simulation/{data,validators}
eth2_network_simulation: | build deps p2pd clean_eth2_network_simulation_files
GIT_ROOT="$$PWD" BUILD_OUTPUTS_DIR="./build" $(ENV_SCRIPT) tests/simulation/start.sh
GIT_ROOT="$$PWD" BUILD_OUTPUTS_DIR="./build" tests/simulation/start.sh
testnet0 testnet1: | build deps p2pd
NIM_PARAMS="$(NIM_PARAMS)" $(ENV_SCRIPT) scripts/build_testnet_node.sh $@

View File

@ -2,7 +2,7 @@
set -eu
. $(dirname $0)/vars.sh
source "$(dirname "$0")/vars.sh"
cd "$GIT_ROOT"
DATA_DIR="${SIMULATION_DIR}/node-${1}"
@ -21,9 +21,9 @@ LAST_VALIDATOR_IDX=$(( (NUM_VALIDATORS / ($NUM_NODES + $NUM_MISSING_NODES)) * ($
mkdir -p $DATA_DIR/validators
rm -f $DATA_DIR/validators/*
pushd $VALIDATORS_DIR
pushd $VALIDATORS_DIR >/dev/null
cp $(seq -s " " -f v%07g.privkey $FIRST_VALIDATOR_IDX $LAST_VALIDATOR_IDX) $DATA_DIR/validators
popd
popd >/dev/null
$BEACON_NODE_BIN \
--network:$NETWORK_METADATA_FILE \

View File

@ -1,9 +1,12 @@
#!/bin/bash
set -euo pipefail
set -eo pipefail
# Read in variables
. "$(dirname "$0")/vars.sh"
source "$(dirname "$0")/vars.sh"
# set up the environment
source "${SIM_ROOT}/../../env.sh"
# Set DEPOSIT_WEB3_URL_ARG to empty to get genesis state from file, not using web3
# export DEPOSIT_WEB3_URL_ARG=--depositWeb3Url=ws://localhost:8545
@ -16,7 +19,7 @@ mkdir -p "$VALIDATORS_DIR"
cd "$GIT_ROOT"
NIMFLAGS="-d:chronicles_log_level=DEBUG --hints:off --opt:speed --debuginfo"
NIMFLAGS="-d:chronicles_log_level=DEBUG --hints:off --warnings:off --opt:speed --debuginfo"
# Run with "SHARD_COUNT=4 ./start.sh" to change these
DEFS=""
@ -29,11 +32,11 @@ LAST_VALIDATOR_NUM=$(( NUM_VALIDATORS - 1 ))
LAST_VALIDATOR="$VALIDATORS_DIR/v$(printf '%07d' $LAST_VALIDATOR_NUM).deposit.json"
echo "Building $BEACON_NODE_BIN ($DEFS)"
"$SIM_ROOT/../../env.sh" nim c -o:"$BEACON_NODE_BIN" $NIMFLAGS $DEFS beacon_chain/beacon_node
nim c -o:"$BEACON_NODE_BIN" $NIMFLAGS $DEFS beacon_chain/beacon_node
if [ ! -f "${LAST_VALIDATOR}" ]; then
echo Building $DEPLOY_DEPOSIT_CONTRACT_BIN
"$SIM_ROOT/../../env.sh" nim c -o:"$DEPLOY_DEPOSIT_CONTRACT_BIN" $NIMFLAGS $DEFS --hints:off -d:release beacon_chain/deploy_deposit_contract
nim c -o:"$DEPLOY_DEPOSIT_CONTRACT_BIN" $NIMFLAGS $DEFS -d:release beacon_chain/deploy_deposit_contract
if [ "$DEPOSIT_WEB3_URL_ARG" != "" ]; then
DEPOSIT_CONTRACT_ADDRESS=$($DEPLOY_DEPOSIT_CONTRACT_BIN $DEPOSIT_WEB3_URL_ARG)