- properly distributing the keys between BNs & VCs - fixing finalization - will switch to ON by default as soon as finalization becomes overall stable

- added a new altona-vc Makefile target which uses a separate VC process
This commit is contained in:
Viktor Kirilov 2020-07-15 16:15:25 +03:00
parent 8970a22fdd
commit 4767eba465
7 changed files with 44 additions and 17 deletions

View File

@ -188,6 +188,22 @@ altona: | beacon_node
--data-dir=build/data/shared_altona_$(NODE_ID) \ --data-dir=build/data/shared_altona_$(NODE_ID) \
$(GOERLI_TESTNETS_PARAMS) $(NODE_PARAMS) $(GOERLI_TESTNETS_PARAMS) $(NODE_PARAMS)
altona-vc: | beacon_node validator_client
# if launching a VC as well - send the BN looking nowhere for validators/secrets
mkdir build/data/shared_altona_$(NODE_ID)/empty_dummy_folder -p
build/beacon_node \
--network=altona \
--log-level="$(LOG_LEVEL)" \
--data-dir=build/data/shared_altona_$(NODE_ID) \
--validators-dir=build/data/shared_altona_$(NODE_ID)/empty_dummy_folder \
--secrets-dir=build/data/shared_altona_$(NODE_ID)/empty_dummy_folder \
$(GOERLI_TESTNETS_PARAMS) $(NODE_PARAMS) &
sleep 4
build/validator_client \
--log-level="$(LOG_LEVEL)" \
--data-dir=build/data/shared_altona_$(NODE_ID) \
--rpc-port=$$(( $(BASE_RPC_PORT) +$(NODE_ID) ))
altona-dev: | beacon_node altona-dev: | beacon_node
build/beacon_node \ build/beacon_node \
--network=altona \ --network=altona \

View File

@ -203,6 +203,17 @@ the `VALIDATORS` between beacon nodes and validator clients - for example with `
validators and `6` nodes you will end up with 6 beacon node and 6 validator client 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. processes, where each of them will handle 16 validators.
<!--
By default, validators will be split in half between beacon node and validator
client processes, communicating through the
[official validator API](https://ethereum.github.io/eth2.0-APIs/#/ValidatorRequiredApi)
(for example with `192` validators and `6` nodes you will roughly end up with 6
beacon node and 6 validator client processes, where each of them will handle 16
validators), but if you don't want to use external validator clients and instead
want to have all the validators handled in-process by the beacon nodes you may
use `BN_VC_VALIDATOR_SPLIT=no` as an additional argument to `make eth2_network_simulation`.
-->
By default, the simulation will start from a pre-generated genesis state. If you wish to 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 simulate the bootstrap process with a Ethereum 1.0 validator deposit contract, start the
simulation with `WAIT_GENESIS=yes` simulation with `WAIT_GENESIS=yes`

View File

@ -706,8 +706,8 @@ func init*(T: type GraffitiBytes, input: string): GraffitiBytes
distinctBase(result)[0 ..< input.len] = toBytes(input) distinctBase(result)[0 ..< input.len] = toBytes(input)
func defaultGraffitiBytes*(): GraffitiBytes = func defaultGraffitiBytes*(): GraffitiBytes =
let graffityBytes = toBytes("Nimbus " & fullVersionStr) let graffitiBytes = toBytes("Nimbus " & fullVersionStr)
distinctBase(result)[0 ..< graffityBytes.len] = graffityBytes distinctBase(result)[0 ..< graffitiBytes.len] = graffitiBytes
proc writeValue*(w: var JsonWriter, value: GraffitiBytes) proc writeValue*(w: var JsonWriter, value: GraffitiBytes)
{.raises: [IOError, Defect].} = {.raises: [IOError, Defect].} =

View File

@ -55,18 +55,16 @@ rm -rf "$NODE_SECRETS_DIR"
mkdir -p "$NODE_SECRETS_DIR" mkdir -p "$NODE_SECRETS_DIR"
VALIDATORS_PER_NODE=$(( NUM_VALIDATORS / (TOTAL_NODES - 1) )) VALIDATORS_PER_NODE=$(( NUM_VALIDATORS / (TOTAL_NODES - 1) ))
if [ "${USE_BN_VC_VALIDATOR_SPLIT:-}" == "yes" ]; then
if [[ $NODE_ID -lt $BOOTSTRAP_NODE ]]; then # if using validator client binaries in addition to beacon nodes we will
# if using validator client binaries in addition to beacon nodes # split the keys for this instance in half between the BN and the VC
# we will split the keys for this instance in half between the BN and the VC # and the validators for the BNs will be from the first half of all validators
if [ "${BN_VC_VALIDATOR_SPLIT:-}" == "yes" ]; then VALIDATORS_PER_NODE=$((VALIDATORS_PER_NODE / 2 ))
ATTACHED_VALIDATORS=$((VALIDATORS_PER_NODE / 2))
else
ATTACHED_VALIDATORS=$VALIDATORS_PER_NODE
fi fi
if [[ $NODE_ID -lt $BOOTSTRAP_NODE ]]; then
pushd "$VALIDATORS_DIR" >/dev/null pushd "$VALIDATORS_DIR" >/dev/null
for VALIDATOR in $(ls | tail -n +$(( ($VALIDATORS_PER_NODE * $NODE_ID) + 1 )) | head -n $ATTACHED_VALIDATORS); do for VALIDATOR in $(ls | tail -n +$(( ($VALIDATORS_PER_NODE * $NODE_ID) + 1 )) | head -n $VALIDATORS_PER_NODE); do
cp -a "$VALIDATOR" "$NODE_VALIDATORS_DIR" cp -a "$VALIDATOR" "$NODE_VALIDATORS_DIR"
cp -a "$SECRETS_DIR/$VALIDATOR" "$NODE_SECRETS_DIR" cp -a "$SECRETS_DIR/$VALIDATOR" "$NODE_SECRETS_DIR"
done done

View File

@ -25,14 +25,15 @@ mkdir -p "$NODE_VALIDATORS_DIR"
rm -rf "$NODE_SECRETS_DIR" rm -rf "$NODE_SECRETS_DIR"
mkdir -p "$NODE_SECRETS_DIR" mkdir -p "$NODE_SECRETS_DIR"
VALIDATORS_PER_NODE=$((NUM_VALIDATORS / TOTAL_NODES)) # we will split the keys for this instance in half between the BN and the VC
# and the validators for the VCs will be from the second half of all validators
VALIDATORS_PER_NODE=$(( (NUM_VALIDATORS / TOTAL_NODES) / 2 ))
VALIDATOR_OFFSET=$((NUM_VALIDATORS / 2))
if [[ $NODE_ID -lt $TOTAL_NODES ]]; then if [[ $NODE_ID -lt $TOTAL_NODES ]]; then
# we will split the keys for this instance in half between the BN and the VC
ATTACHED_VALIDATORS=$((VALIDATORS_PER_NODE / 2))
pushd "$VALIDATORS_DIR" >/dev/null pushd "$VALIDATORS_DIR" >/dev/null
for VALIDATOR in $(ls | tail -n +$(( ($VALIDATORS_PER_NODE * $NODE_ID) + 1 + $ATTACHED_VALIDATORS )) | head -n $ATTACHED_VALIDATORS); do for VALIDATOR in $(ls | tail -n +$(( $VALIDATOR_OFFSET + ($VALIDATORS_PER_NODE * $NODE_ID) + 1 )) | head -n $VALIDATORS_PER_NODE); do
cp -ar "$VALIDATOR" "$NODE_VALIDATORS_DIR" cp -ar "$VALIDATOR" "$NODE_VALIDATORS_DIR"
cp -a "$SECRETS_DIR/$VALIDATOR" "$NODE_SECRETS_DIR" cp -a "$SECRETS_DIR/$VALIDATOR" "$NODE_SECRETS_DIR"
done done

View File

@ -231,8 +231,8 @@ for i in $(seq $BOOTSTRAP_NODE -1 $TOTAL_USER_NODES); do
run_cmd $i "${SIM_ROOT}/run_node.sh ${i} --verify-finalization" "node" run_cmd $i "${SIM_ROOT}/run_node.sh ${i} --verify-finalization" "node"
if [ "${BN_VC_VALIDATOR_SPLIT:-}" == "yes" ]; then if [ "${USE_BN_VC_VALIDATOR_SPLIT:-}" == "yes" ]; then
# start the VC with a few seconds of delay so that we can connect through RPC # start the VC with a few seconds of delay so that there are less RPC connection retries
run_cmd $i "sleep 3 && ${SIM_ROOT}/run_validator.sh ${i}" "validator" run_cmd $i "sleep 3 && ${SIM_ROOT}/run_validator.sh ${i}" "validator"
fi fi
done done

View File

@ -24,6 +24,7 @@ TOTAL_NODES=${NODES:-4}
TOTAL_USER_NODES=${USER_NODES:-0} TOTAL_USER_NODES=${USER_NODES:-0}
TOTAL_SYSTEM_NODES=$(( TOTAL_NODES - TOTAL_USER_NODES )) TOTAL_SYSTEM_NODES=$(( TOTAL_NODES - TOTAL_USER_NODES ))
BOOTSTRAP_NODE=$(( TOTAL_NODES - 1 )) BOOTSTRAP_NODE=$(( TOTAL_NODES - 1 ))
USE_BN_VC_VALIDATOR_SPLIT=${BN_VC_VALIDATOR_SPLIT:-no}
SIMULATION_DIR="${SIM_ROOT}/data" SIMULATION_DIR="${SIM_ROOT}/data"
METRICS_DIR="${SIM_ROOT}/prometheus" METRICS_DIR="${SIM_ROOT}/prometheus"