Skip to content

Commit d598018

Browse files
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: Barnabas Busa <busa.barnabas@gmail.com>
1 parent fce899b commit d598018

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ network_params:
248248
# 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
249249
# validator keys already preregistered as validators
250250
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"
251+
# The number of pre-registered validators for genesis. If 0 or not specified then the value will be calculated from the participants
252+
preregistered_validator_count: 0
251253
# How long you want the network to wait before starting up
252254
genesis_delay: 120
253255

network_params.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ network_params:
4242
"giant issue aisle success illegal bike spike
4343
question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy
4444
very lucky have athlete"
45+
preregistered_validator_count: 0
4546
genesis_delay: 120
4647
max_churn: 8
4748
ejection_balance: 16000000000

src/package_io/input_parser.star

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ def input_parser(plan, input_args):
163163
preregistered_validator_keys_mnemonic=result["network_params"][
164164
"preregistered_validator_keys_mnemonic"
165165
],
166+
preregistered_validator_count=result["network_params"][
167+
"preregistered_validator_count"
168+
],
166169
num_validator_keys_per_node=result["network_params"][
167170
"num_validator_keys_per_node"
168171
],
@@ -407,6 +410,7 @@ def default_network_params():
407410
# this is temporary till we get params working
408411
return {
409412
"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",
413+
"preregistered_validator_count": 0,
410414
"num_validator_keys_per_node": 64,
411415
"network_id": "3151908",
412416
"deposit_contract_address": "0x4242424242424242424242424242424242424242",

src/participant_network.star

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ def launch_participant_network(
7878
plan, CL_GENESIS_DATA_GENERATION_TIME + num_participants * CL_NODE_STARTUP_TIME
7979
)
8080

81-
total_number_of_validator_keys = 0
82-
for participant in participants:
83-
total_number_of_validator_keys += participant.validator_count
81+
# if preregistered validator count is 0 (default) then calculate the total number of validators from the participants
82+
total_number_of_validator_keys = network_params.preregistered_validator_count
83+
84+
if network_params.preregistered_validator_count == 0:
85+
for participant in participants:
86+
total_number_of_validator_keys += participant.validator_count
8487

8588
plan.print("Generating EL CL data")
8689
# we are running bellatrix genesis (deprecated) - will be removed in the future

0 commit comments

Comments
 (0)