Commit d598018a authored by Tyler's avatar Tyler Committed by GitHub

feat: add preregistered_validator_count network param field (#426)

This PR allows you to set network_params.preregistered_validator_count.
If not set, or set to 0 the original behavior of calculating the total
validators via summing the staked participants is applied.
Co-authored-by: default avatarBarnabas Busa <busa.barnabas@gmail.com>
parent fce899be
...@@ -248,6 +248,8 @@ network_params: ...@@ -248,6 +248,8 @@ network_params:
# This mnemonic will a) be used to create keystores for all the types of validators that we have and b) be used to generate a CL genesis.ssz that has the children # This mnemonic will a) be used to create keystores for all the types of validators that we have and b) be used to generate a CL genesis.ssz that has the children
# validator keys already preregistered as validators # validator keys already preregistered as validators
preregistered_validator_keys_mnemonic: "giant issue aisle success illegal bike spike question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy very lucky have athlete" preregistered_validator_keys_mnemonic: "giant issue aisle success illegal bike spike question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy very lucky have athlete"
# The number of pre-registered validators for genesis. If 0 or not specified then the value will be calculated from the participants
preregistered_validator_count: 0
# How long you want the network to wait before starting up # How long you want the network to wait before starting up
genesis_delay: 120 genesis_delay: 120
......
...@@ -42,6 +42,7 @@ network_params: ...@@ -42,6 +42,7 @@ network_params:
"giant issue aisle success illegal bike spike "giant issue aisle success illegal bike spike
question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy
very lucky have athlete" very lucky have athlete"
preregistered_validator_count: 0
genesis_delay: 120 genesis_delay: 120
max_churn: 8 max_churn: 8
ejection_balance: 16000000000 ejection_balance: 16000000000
......
...@@ -163,6 +163,9 @@ def input_parser(plan, input_args): ...@@ -163,6 +163,9 @@ def input_parser(plan, input_args):
preregistered_validator_keys_mnemonic=result["network_params"][ preregistered_validator_keys_mnemonic=result["network_params"][
"preregistered_validator_keys_mnemonic" "preregistered_validator_keys_mnemonic"
], ],
preregistered_validator_count=result["network_params"][
"preregistered_validator_count"
],
num_validator_keys_per_node=result["network_params"][ num_validator_keys_per_node=result["network_params"][
"num_validator_keys_per_node" "num_validator_keys_per_node"
], ],
...@@ -407,6 +410,7 @@ def default_network_params(): ...@@ -407,6 +410,7 @@ def default_network_params():
# this is temporary till we get params working # this is temporary till we get params working
return { return {
"preregistered_validator_keys_mnemonic": "giant issue aisle success illegal bike spike question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy very lucky have athlete", "preregistered_validator_keys_mnemonic": "giant issue aisle success illegal bike spike question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy very lucky have athlete",
"preregistered_validator_count": 0,
"num_validator_keys_per_node": 64, "num_validator_keys_per_node": 64,
"network_id": "3151908", "network_id": "3151908",
"deposit_contract_address": "0x4242424242424242424242424242424242424242", "deposit_contract_address": "0x4242424242424242424242424242424242424242",
......
...@@ -78,9 +78,12 @@ def launch_participant_network( ...@@ -78,9 +78,12 @@ def launch_participant_network(
plan, CL_GENESIS_DATA_GENERATION_TIME + num_participants * CL_NODE_STARTUP_TIME plan, CL_GENESIS_DATA_GENERATION_TIME + num_participants * CL_NODE_STARTUP_TIME
) )
total_number_of_validator_keys = 0 # if preregistered validator count is 0 (default) then calculate the total number of validators from the participants
for participant in participants: total_number_of_validator_keys = network_params.preregistered_validator_count
total_number_of_validator_keys += participant.validator_count
if network_params.preregistered_validator_count == 0:
for participant in participants:
total_number_of_validator_keys += participant.validator_count
plan.print("Generating EL CL data") plan.print("Generating EL CL data")
# we are running bellatrix genesis (deprecated) - will be removed in the future # we are running bellatrix genesis (deprecated) - will be removed in the future
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment