Skip to content

Commit

Permalink
feat: add preregistered_validator_count network param field (#426)
Browse files Browse the repository at this point in the history
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: Barnabas Busa <[email protected]>
  • Loading branch information
0xTylerHolmes and barnabasbusa authored Jan 2, 2024
1 parent fce899b commit d598018
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
# 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"
# 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
genesis_delay: 120

Expand Down
1 change: 1 addition & 0 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ network_params:
"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
genesis_delay: 120
max_churn: 8
ejection_balance: 16000000000
Expand Down
4 changes: 4 additions & 0 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ def input_parser(plan, input_args):
preregistered_validator_keys_mnemonic=result["network_params"][
"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"
],
Expand Down Expand Up @@ -407,6 +410,7 @@ def default_network_params():
# this is temporary till we get params working
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_count": 0,
"num_validator_keys_per_node": 64,
"network_id": "3151908",
"deposit_contract_address": "0x4242424242424242424242424242424242424242",
Expand Down
9 changes: 6 additions & 3 deletions src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ def launch_participant_network(
plan, CL_GENESIS_DATA_GENERATION_TIME + num_participants * CL_NODE_STARTUP_TIME
)

total_number_of_validator_keys = 0
for participant in participants:
total_number_of_validator_keys += participant.validator_count
# if preregistered validator count is 0 (default) then calculate the total number of validators from the participants
total_number_of_validator_keys = network_params.preregistered_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")
# we are running bellatrix genesis (deprecated) - will be removed in the future
Expand Down

0 comments on commit d598018

Please sign in to comment.