Skip to content

Commit 18b141e

Browse files
fix: zero count validators and parallel keystore generation (ethpandaops#302)
Co-authored-by: Barnabas Busa <busa.barnabas@gmail.com>
1 parent 49596fd commit 18b141e

File tree

5 files changed

+92
-4
lines changed

5 files changed

+92
-4
lines changed

.circleci/config.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,25 @@ jobs:
251251
- checkout
252252
- run: kurtosis run ${PWD} "$(cat ./.circleci/tests/mix-with-tools.json)"
253253

254+
parallel_key_store_generation_1:
255+
executor: ubuntu_vm
256+
steps:
257+
- <<: *setup_kurtosis
258+
- checkout
259+
- run: kurtosis run ${PWD} "$(cat ./.circleci/tests/parallel-keystores-1.json)"
260+
parallel_key_store_generation_2:
261+
executor: ubuntu_vm
262+
steps:
263+
- <<: *setup_kurtosis
264+
- checkout
265+
- run: kurtosis run ${PWD} "$(cat ./.circleci/tests/parallel-keystores-2.json)"
266+
parallel_key_store_generation_3:
267+
executor: ubuntu_vm
268+
steps:
269+
- <<: *setup_kurtosis
270+
- checkout
271+
- run: kurtosis run ${PWD} "$(cat ./.circleci/tests/parallel-keystores-3.json)"
272+
254273
workflows:
255274
check_latest_version:
256275
when: << pipeline.parameters.should-enable-check-latest-version-workflow >>
@@ -301,12 +320,12 @@ workflows:
301320
filters:
302321
branches:
303322
ignore:
304-
- main
323+
- main
305324
- lint:
306325
filters:
307326
branches:
308327
ignore:
309-
- main
328+
- main
310329
- mev:
311330
filters:
312331
branches:
@@ -325,3 +344,19 @@ workflows:
325344
branches:
326345
ignore:
327346
- main
347+
348+
- parallel_key_store_generation_1:
349+
filters:
350+
branches:
351+
ignore:
352+
- main
353+
- parallel_key_store_generation_2:
354+
filters:
355+
branches:
356+
ignore:
357+
- main
358+
- parallel_key_store_generation_3:
359+
filters:
360+
branches:
361+
ignore:
362+
- main
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"participants": [
3+
{
4+
"el_client_type": "geth",
5+
"cl_client_type": "teku"
6+
},
7+
{
8+
"el_client_type": "geth",
9+
"cl_client_type": "teku",
10+
"validator_count": 0
11+
}
12+
],
13+
"parallel_keystore_generation": true
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"participants": [
3+
{
4+
"el_client_type": "geth",
5+
"cl_client_type": "teku",
6+
"validator_count": 0
7+
},
8+
{
9+
"el_client_type": "geth",
10+
"cl_client_type": "teku"
11+
}
12+
],
13+
"parallel_keystore_generation": true
14+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"participants": [
3+
{
4+
"el_client_type": "geth",
5+
"cl_client_type": "teku"
6+
},
7+
{
8+
"el_client_type": "geth",
9+
"cl_client_type": "teku",
10+
"validator_count": 0
11+
},
12+
{
13+
"el_client_type": "geth",
14+
"cl_client_type": "teku"
15+
}
16+
],
17+
"parallel_keystore_generation": true
18+
}

src/prelaunch_data_generator/cl_validator_keystores/cl_validator_keystore_generator.star

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ def generate_cl_valdiator_keystores_in_parallel(plan, mnemonic, participants):
163163
for idx, participant in enumerate(participants):
164164
output_dirpath = NODE_KEYSTORES_OUTPUT_DIRPATH_FORMAT_STR.format(idx)
165165
if participant.validator_count == 0:
166-
all_output_dirpaths.append(output_dirpath)
166+
all_generation_commands.append(None)
167+
all_output_dirpaths.append(None)
168+
finished_files_to_verify.append(None)
167169
continue
168170
start_index = idx * participant.validator_count
169171
stop_index = (idx + 1) * participant.validator_count
@@ -188,6 +190,9 @@ def generate_cl_valdiator_keystores_in_parallel(plan, mnemonic, participants):
188190
for idx in range(0, len(participants)):
189191
service_name = service_names[idx]
190192
generation_command = all_generation_commands[idx]
193+
if generation_command == None:
194+
# no generation command as validator count is 0
195+
continue
191196
plan.exec(
192197
recipe=ExecRecipe(
193198
command=["sh", "-c", generation_command + " >/dev/null 2>&1 &"]
@@ -199,6 +204,9 @@ def generate_cl_valdiator_keystores_in_parallel(plan, mnemonic, participants):
199204
for idx in range(0, len(participants)):
200205
service_name = service_names[idx]
201206
output_dirpath = all_output_dirpaths[idx]
207+
if output_dirpath == None:
208+
# no output dir path as validator count is 0
209+
continue
202210
generation_finished_filepath = finished_files_to_verify[idx]
203211
verificaiton_command = ["ls", generation_finished_filepath]
204212
plan.wait(
@@ -221,7 +229,6 @@ def generate_cl_valdiator_keystores_in_parallel(plan, mnemonic, participants):
221229
service_name = service_names[idx]
222230
output_dirpath = all_output_dirpaths[idx]
223231

224-
running_total_validator_count += participant.validator_count
225232
padded_idx = zfill_custom(idx + 1, len(str(len(participants))))
226233
keystore_start_index = running_total_validator_count
227234
running_total_validator_count += participant.validator_count

0 commit comments

Comments
 (0)