Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: zero count validators and parallel keystore generation #302

Merged
merged 8 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,25 @@ jobs:
- checkout
- run: kurtosis run ${PWD} "$(cat ./.circleci/tests/mix-with-tools.json)"

parallel_key_store_generation_1:
executor: ubuntu_vm
steps:
- <<: *setup_kurtosis
- checkout
- run: kurtosis run ${PWD} "$(cat ./.circleci/tests/parallel-keystores-1.json)"
parallel_key_store_generation_2:
executor: ubuntu_vm
steps:
- <<: *setup_kurtosis
- checkout
- run: kurtosis run ${PWD} "$(cat ./.circleci/tests/parallel-keystores-2.json)"
parallel_key_store_generation_3:
executor: ubuntu_vm
steps:
- <<: *setup_kurtosis
- checkout
- run: kurtosis run ${PWD} "$(cat ./.circleci/tests/parallel-keystores-3.json)"

workflows:
check_latest_version:
when: << pipeline.parameters.should-enable-check-latest-version-workflow >>
Expand Down Expand Up @@ -301,12 +320,12 @@ workflows:
filters:
branches:
ignore:
- main
- main
- lint:
filters:
branches:
ignore:
- main
- main
- mev:
filters:
branches:
Expand All @@ -325,3 +344,19 @@ workflows:
branches:
ignore:
- main

- parallel_key_store_generation_1:
filters:
branches:
ignore:
- main
- parallel_key_store_generation_2:
filters:
branches:
ignore:
- main
- parallel_key_store_generation_3:
filters:
branches:
ignore:
- main
14 changes: 14 additions & 0 deletions .circleci/tests/parallel-keystores-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"participants": [
{
"el_client_type": "geth",
"cl_client_type": "teku"
},
{
"el_client_type": "geth",
"cl_client_type": "teku",
"validator_count": 0
}
],
"parallel_keystore_generation": true
}
14 changes: 14 additions & 0 deletions .circleci/tests/parallel-keystores-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"participants": [
{
"el_client_type": "geth",
"cl_client_type": "teku",
"validator_count": 0
},
{
"el_client_type": "geth",
"cl_client_type": "teku"
}
],
"parallel_keystore_generation": true
}
18 changes: 18 additions & 0 deletions .circleci/tests/parallel-keystores-3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"participants": [
{
"el_client_type": "geth",
"cl_client_type": "teku"
},
{
"el_client_type": "geth",
"cl_client_type": "teku",
"validator_count": 0
},
{
"el_client_type": "geth",
"cl_client_type": "teku"
}
],
"parallel_keystore_generation": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ def generate_cl_valdiator_keystores_in_parallel(plan, mnemonic, participants):
for idx, participant in enumerate(participants):
output_dirpath = NODE_KEYSTORES_OUTPUT_DIRPATH_FORMAT_STR.format(idx)
if participant.validator_count == 0:
all_output_dirpaths.append(output_dirpath)
all_generation_commands.append(None)
all_output_dirpaths.append(None)
finished_files_to_verify.append(None)
continue
start_index = idx * participant.validator_count
stop_index = (idx + 1) * participant.validator_count
Expand All @@ -188,6 +190,9 @@ def generate_cl_valdiator_keystores_in_parallel(plan, mnemonic, participants):
for idx in range(0, len(participants)):
service_name = service_names[idx]
generation_command = all_generation_commands[idx]
if generation_command == None:
# no generation command as validator count is 0
continue
plan.exec(
recipe=ExecRecipe(
command=["sh", "-c", generation_command + " >/dev/null 2>&1 &"]
Expand All @@ -199,6 +204,9 @@ def generate_cl_valdiator_keystores_in_parallel(plan, mnemonic, participants):
for idx in range(0, len(participants)):
service_name = service_names[idx]
output_dirpath = all_output_dirpaths[idx]
if output_dirpath == None:
# no output dir path as validator count is 0
continue
generation_finished_filepath = finished_files_to_verify[idx]
verificaiton_command = ["ls", generation_finished_filepath]
plan.wait(
Expand All @@ -221,7 +229,6 @@ def generate_cl_valdiator_keystores_in_parallel(plan, mnemonic, participants):
service_name = service_names[idx]
output_dirpath = all_output_dirpaths[idx]

running_total_validator_count += participant.validator_count
padded_idx = zfill_custom(idx + 1, len(str(len(participants))))
keystore_start_index = running_total_validator_count
running_total_validator_count += participant.validator_count
Expand Down