Skip to content

Commit f9b638b

Browse files
authored
feat: counting by summing each participant (ethereum#112)
This PR changes the way we count the actual number of validators by summing `count`s for each participant and multiplying by the number of validator keys per node. Resolves ethpandaops/ethereum-package#111 Changelog picked up from commits here: feat: counting by summing each participant
1 parent 2a8ad19 commit f9b638b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/package_io/parse_input.star

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def parse_input(input_args):
4545
participants.append(new_participant)
4646
result["participants"] = participants
4747

48+
total_participant_count = 0
4849
# validation of the above defaults
4950
for index, participant in enumerate(result["participants"]):
5051
el_client_type = participant["el_client_type"]
@@ -76,6 +77,8 @@ def parse_input(input_args):
7677
validator_extra_params = participant.get("validator_extra_params", [])
7778
participant["validator_extra_params"] = validator_extra_params
7879

80+
total_participant_count += participant["count"]
81+
7982
if result["network_params"]["network_id"].strip() == "":
8083
fail("network_id is empty or spaces it needs to be of non zero length")
8184

@@ -100,10 +103,13 @@ def parse_input(input_args):
100103
if result["network_params"]["deneb_fork_epoch"] == 0:
101104
fail("deneb_fork_epoch is 0 needs to be > 0 ")
102105

103-
required_num_validtors = 2 * result["network_params"]["slots_per_epoch"]
104-
actual_num_validators = len(result["participants"]) * result["network_params"]["num_validator_keys_per_node"]
105-
if required_num_validtors > actual_num_validators:
106-
fail("required_num_validtors - {0} is greater than actual_num_validators - {1}".format(required_num_validtors, actual_num_validators))
106+
if total_participant_count < 1:
107+
total_participant_count = 1
108+
109+
required_num_validators = 2 * result["network_params"]["slots_per_epoch"]
110+
actual_num_validators = total_participant_count * result["network_params"]["num_validator_keys_per_node"]
111+
if required_num_validators > actual_num_validators:
112+
fail("required_num_validators - {0} is greater than actual_num_validators - {1}".format(required_num_validators, actual_num_validators))
107113

108114
# Remove if nethermind doesn't break as second node we already test above if its the first node
109115
if len(result["participants"]) >= 2 and result["participants"][1]["el_client_type"] == NETHERMIND_NODE_NAME:

0 commit comments

Comments
 (0)