Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
feat: Rename keytores to match their respective CL name (#71)
Browse files Browse the repository at this point in the history
Fixes #68 

<img width="1049" alt="Screenshot 2023-07-26 at 10 55 26"
src="https://github.com/kurtosis-tech/eth-network-package/assets/18011812/f885fb11-092b-4c62-8ab9-86ba18560443">
  • Loading branch information
Guillaume Bouvignies authored Jul 26, 2023
1 parent 7427326 commit 83e68b2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def launch_participant_network(plan, participants, network_params, global_log_le
cl_validator_data = cl_validator_keystores.generate_cl_validator_keystores(
plan,
network_params.preregistered_validator_keys_mnemonic,
num_participants,
participants,
network_params.num_validator_keys_per_node,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEKU_SECRETS_DIRNAME = "teku-secrets"
def generate_cl_validator_keystores(
plan,
mnemonic,
num_nodes,
participants,
num_validators_per_node):

service_name = prelaunch_data_generator_launcher.launch_prelaunch_data_generator(
Expand All @@ -46,8 +46,8 @@ def generate_cl_validator_keystores(
start_index = 0
stop_index = num_validators_per_node

for i in range(num_nodes):
output_dirpath = NODE_KEYSTORES_OUTPUT_DIRPATH_FORMAT_STR.format(i)
for idx, participant in enumerate(participants):
output_dirpath = NODE_KEYSTORES_OUTPUT_DIRPATH_FORMAT_STR.format(idx)

generate_keystores_cmd = "{0} keystores --insecure --prysm-pass {1} --out-loc {2} --source-mnemonic \"{3}\" --source-min {4} --source-max {5}".format(
KEYSTORES_GENERATION_TOOL_NAME,
Expand All @@ -61,9 +61,8 @@ def generate_cl_validator_keystores(
all_sub_command_strs.append(generate_keystores_cmd)
all_output_dirpaths.append(output_dirpath)

start_index = stop_index
stop_index = stop_index + num_validators_per_node

start_index = idx * num_validators_per_node
stop_index = (idx+1) * num_validators_per_node - 1

command_str = " && ".join(all_sub_command_strs)

Expand All @@ -72,8 +71,20 @@ def generate_cl_validator_keystores(

# Store outputs into files artifacts
keystore_files = []
for idx, output_dirpath in enumerate(all_output_dirpaths):
artifact_name = plan.store_service_files(service_name, output_dirpath, name = "validator-keystore-" + str(idx+1))
for idx, participant in enumerate(participants):
output_dirpath = all_output_dirpaths[idx]

padded_idx = zfill_custom(idx+1, len(str(len(participants))))
keystore_start_index = idx * num_validators_per_node
keystore_stop_index = (idx+1) * num_validators_per_node - 1
artifact_name = "{0}-{1}-{2}-{3}-{4}".format(
padded_idx,
participant.cl_client_type,
participant.el_client_type,
keystore_start_index,
keystore_stop_index,
)
artifact_name = plan.store_service_files(service_name, output_dirpath, name=artifact_name)

# This is necessary because the way Kurtosis currently implements artifact-storing is
base_dirname_in_artifact = shared_utils.path_base(output_dirpath)
Expand Down Expand Up @@ -112,3 +123,6 @@ def generate_cl_validator_keystores(
# we cleanup as the data generation is done
plan.remove_service(service_name)
return result

def zfill_custom(value, width):
return ("0" * (width - len(str(value)))) + str(value)

0 comments on commit 83e68b2

Please sign in to comment.