Commit f9b638bc authored by Anders Schwartz's avatar Anders Schwartz Committed by GitHub

feat: counting by summing each participant (#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 https://github.com/kurtosis-tech/eth2-package/issues/111

Changelog picked up from commits here:

feat: counting by summing each participant
parent 2a8ad19e
...@@ -45,6 +45,7 @@ def parse_input(input_args): ...@@ -45,6 +45,7 @@ def parse_input(input_args):
participants.append(new_participant) participants.append(new_participant)
result["participants"] = participants result["participants"] = participants
total_participant_count = 0
# validation of the above defaults # validation of the above defaults
for index, participant in enumerate(result["participants"]): for index, participant in enumerate(result["participants"]):
el_client_type = participant["el_client_type"] el_client_type = participant["el_client_type"]
...@@ -76,6 +77,8 @@ def parse_input(input_args): ...@@ -76,6 +77,8 @@ def parse_input(input_args):
validator_extra_params = participant.get("validator_extra_params", []) validator_extra_params = participant.get("validator_extra_params", [])
participant["validator_extra_params"] = validator_extra_params participant["validator_extra_params"] = validator_extra_params
total_participant_count += participant["count"]
if result["network_params"]["network_id"].strip() == "": if result["network_params"]["network_id"].strip() == "":
fail("network_id is empty or spaces it needs to be of non zero length") fail("network_id is empty or spaces it needs to be of non zero length")
...@@ -100,10 +103,13 @@ def parse_input(input_args): ...@@ -100,10 +103,13 @@ def parse_input(input_args):
if result["network_params"]["deneb_fork_epoch"] == 0: if result["network_params"]["deneb_fork_epoch"] == 0:
fail("deneb_fork_epoch is 0 needs to be > 0 ") fail("deneb_fork_epoch is 0 needs to be > 0 ")
required_num_validtors = 2 * result["network_params"]["slots_per_epoch"] if total_participant_count < 1:
actual_num_validators = len(result["participants"]) * result["network_params"]["num_validator_keys_per_node"] total_participant_count = 1
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)) 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 # 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: if len(result["participants"]) >= 2 and result["participants"][1]["el_client_type"] == NETHERMIND_NODE_NAME:
......
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