Skip to content

Commit

Permalink
feat: counting by summing each participant (#112)
Browse files Browse the repository at this point in the history
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 #111

Changelog picked up from commits here:

feat: counting by summing each participant
  • Loading branch information
adschwartz authored Aug 2, 2023
1 parent 2a8ad19 commit f9b638b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/package_io/parse_input.star
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def parse_input(input_args):
participants.append(new_participant)
result["participants"] = participants

total_participant_count = 0
# validation of the above defaults
for index, participant in enumerate(result["participants"]):
el_client_type = participant["el_client_type"]
Expand Down Expand Up @@ -76,6 +77,8 @@ def parse_input(input_args):
validator_extra_params = participant.get("validator_extra_params", [])
participant["validator_extra_params"] = validator_extra_params

total_participant_count += participant["count"]

if result["network_params"]["network_id"].strip() == "":
fail("network_id is empty or spaces it needs to be of non zero length")

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

required_num_validtors = 2 * result["network_params"]["slots_per_epoch"]
actual_num_validators = len(result["participants"]) * result["network_params"]["num_validator_keys_per_node"]
if required_num_validtors > actual_num_validators:
fail("required_num_validtors - {0} is greater than actual_num_validators - {1}".format(required_num_validtors, actual_num_validators))
if total_participant_count < 1:
total_participant_count = 1

required_num_validators = 2 * result["network_params"]["slots_per_epoch"]
actual_num_validators = total_participant_count * result["network_params"]["num_validator_keys_per_node"]
if required_num_validators > actual_num_validators:
fail("required_num_validators - {0} is greater than actual_num_validators - {1}".format(required_num_validators, actual_num_validators))

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

0 comments on commit f9b638b

Please sign in to comment.