From 84e015030b0aa722cc7601672b98db0176230bd5 Mon Sep 17 00:00:00 2001 From: Anders Schwartz Date: Mon, 31 Jul 2023 11:34:52 -0400 Subject: [PATCH 1/2] feat: counting by summing each participant --- src/package_io/parse_input.star | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/package_io/parse_input.star b/src/package_io/parse_input.star index 14927e4b2..fdb057301 100644 --- a/src/package_io/parse_input.star +++ b/src/package_io/parse_input.star @@ -45,6 +45,7 @@ def parse_input(input_args): participants.append(new_participant) result["participants"] = participants + total_participant_count = 1 # validation of the above defaults for index, participant in enumerate(result["participants"]): el_client_type = participant["el_client_type"] @@ -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") @@ -100,10 +103,10 @@ 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)) + 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: From 47cc18d414ec96fb0956393d86ca2f76b7ee9fb3 Mon Sep 17 00:00:00 2001 From: Anders Schwartz Date: Tue, 1 Aug 2023 10:00:25 -0400 Subject: [PATCH 2/2] fix --- src/package_io/parse_input.star | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/package_io/parse_input.star b/src/package_io/parse_input.star index fdb057301..455bca452 100644 --- a/src/package_io/parse_input.star +++ b/src/package_io/parse_input.star @@ -45,7 +45,7 @@ def parse_input(input_args): participants.append(new_participant) result["participants"] = participants - total_participant_count = 1 + total_participant_count = 0 # validation of the above defaults for index, participant in enumerate(result["participants"]): el_client_type = participant["el_client_type"] @@ -103,6 +103,9 @@ def parse_input(input_args): if result["network_params"]["deneb_fork_epoch"] == 0: fail("deneb_fork_epoch is 0 needs to be > 0 ") + 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: