Commit 665985b6 authored by Gyanendra Mishra's avatar Gyanendra Mishra

a bit better

parent 7a8ed45c
......@@ -12,7 +12,7 @@ def launch_participant_network(network_params):
network_params.num_validator_keys_per_node
)
print("Success " + keystore_result)
print("Success " + str(keystore_result))
genesis_timestamp = time.now().unix
......@@ -25,7 +25,7 @@ def launch_participant_network(network_params):
network_params.deposit_contract_address
)
print("Success " + el_genesis_data)
print("Success " + str(el_genesis_data))
print("Generating CL data")
......@@ -44,4 +44,4 @@ def launch_participant_network(network_params):
)
print("Success " + cl_data)
print("Success " + str(cl_data))
......@@ -7,7 +7,7 @@ load("github.com/kurtosis-tech/eth2-module/src/participant_network/prelaunch_dat
EL_GENESIS_DIRPATH_ON_GENERATOR = "/el-genesis"
CONFIG_DIRPATH_ON_GENERATOR = "/config"
GENESIS_CONFIG_YML_FILENAME = "config.yaml" // WARNING: Do not change this! It will get copied to the CL genesis data, and the CL clients are hardcoded to look for this filename
GENESIS_CONFIG_YML_FILENAME = "config.yaml" # WARNING: Do not change this! It will get copied to the CL genesis data, and the CL clients are hardcoded to look for this filename
MNEMONICS_YML_FILENAME = "mnemonics.yaml"
OUTPUT_DIRPATH_ON_GENERATOR = "/output"
TRANCHES_DIRANME = "tranches"
......@@ -24,31 +24,31 @@ SUCCESSFUL_EXEC_CMD_EXIT_CODE = 0
def generate_cl_genesis_data(
genesis_generation_config_yml_template,
genesis_generation_mnemonics_yml_template,
el_genesis_data,
genesis_unix_timestamp,
network_id,
deposit_contract_address,
seconds_per_slot,
preregistered_validator_keys_mnemonic,
total_num_validator_keys_to_preregister):
template_data = new_cl_genesis_config_template_data{
network_id,
seconds_per_slot,
genesis_unix_timestamp,
total_num_validator_keys_to_preregister,
preregistered_validator_keys_mnemonic,
deposit_contract_address,
}
genesis_generation_config_yml_template,
genesis_generation_mnemonics_yml_template,
el_genesis_data,
genesis_unix_timestamp,
network_id,
deposit_contract_address,
seconds_per_slot,
preregistered_validator_keys_mnemonic,
total_num_validator_keys_to_preregister):
template_data = new_cl_genesis_config_template_data(
network_id,
seconds_per_slot,
genesis_unix_timestamp,
total_num_validator_keys_to_preregister,
preregistered_validator_keys_mnemonic,
deposit_contract_address,
)
genesis_generation_mnemonics_template_and_data = new_template_and_data(genesis_generation_mnemonics_yml_template, template_data)
genesis_generation_config_template_and_data = new_template_and_data(genesis_generation_config_yml_template, template_data)
template_and_data_by_rel_dest_filepath = {}
template_and_data_by_rel_dest_filepath[MNEMONICS_YML_FILENAME] = genesis_generation_mnemonics_template_and_data
template_and_data_by_rel_dest_filepath[GENESIS_CONFIG_YML_FILENAME] = genesisGenerationConfigTemplateAndData
template_and_data_by_rel_dest_filepath[GENESIS_CONFIG_YML_FILENAME] = genesis_generation_config_template_and_data
genesis_generation_config_artifact_uuid = render_templates(template_and_data_by_rel_dest_filepath)
......@@ -71,7 +71,7 @@ def generate_cl_genesis_data(
all_dirpath_creation_commands = []
for dirpath_to_create_on_generator in all_dirpaths_to_create_on_generator:
all_dirpath_creation_commands.append(
"mkdir -p {0}".format(dirpathToCreateOnGenerator))
"mkdir -p {0}".format(dirpath_to_create_on_generator))
dir_creation_cmd = [
"bash",
......@@ -84,8 +84,8 @@ def generate_cl_genesis_data(
# Copy files to output
all_filepaths_to_copy_to_ouptut_directory = [
path_join(config_dirpath_on_generator, GENESIS_CONFIG_YML_FILENAME),
path_join(config_dirpath_on_generator, MNEMONICS_YML_FILENAME),
path_join(CONFIG_DIRPATH_ON_GENERATOR, GENESIS_CONFIG_YML_FILENAME),
path_join(CONFIG_DIRPATH_ON_GENERATOR, MNEMONICS_YML_FILENAME),
path_join(EL_GENESIS_DIRPATH_ON_GENERATOR, el_genesis_data.jwt_secret_relative_filepath),
]
......@@ -153,11 +153,11 @@ def generate_cl_genesis_data(
def new_cl_genesis_config_template_data(network_id, seconds_per_slot, unix_timestamp, num_validator_keys_to_preregister, preregistered_validator_keys_mnemonic, deposit_contract_address):
return {
"NetworkId": network_id,
"SecondsPerSlot": seconds_per_slot,
"UnixTimestamp": unix_timestamp,
"NumValidatorKeysToPreregister": num_validator_keys_to_preregister,
"PreregisteredValidatorKeysMnemonic": preregistered_validator_keys_mnemonic,
"DepositContractAddress": deposit_contract_address,
}
return {
"NetworkId": network_id,
"SecondsPerSlot": seconds_per_slot,
"UnixTimestamp": unix_timestamp,
"NumValidatorKeysToPreregister": num_validator_keys_to_preregister,
"PreregisteredValidatorKeysMnemonic": preregistered_validator_keys_mnemonic,
"DepositContractAddress": deposit_contract_address,
}
......@@ -68,7 +68,7 @@ def generate_cl_validator_keystores(
stop_index = stop_index + num_validators_per_node
command_str = " && ".Join(all_sub_command_strs)
command_str = " && ".join(all_sub_command_strs)
exec(service_id, ["sh", "-c", command_str], SUCCESSFUL_EXEC_CMD_EXIT_CODE)
......
# One of these will be created per node we're trying to start
def new_keystore_files(files_artifact_u_ui_d, raw_keys_relative_dirpath, raw_secrets_relative_dirpath, nimbus_keys_relative_dirpath, prysm_relative_dirpath, teku_keys_relative_dirpath, teku_secrets_relative_dirpath):
def new_keystore_files(files_artifact_uuid, raw_keys_relative_dirpath, raw_secrets_relative_dirpath, nimbus_keys_relative_dirpath, prysm_relative_dirpath, teku_keys_relative_dirpath, teku_secrets_relative_dirpath):
return struct(
FilesArtifactUUID = files_artifact_uuid,
# ------------ All directories below are relative to the root of the files artifact ----------------
......
......@@ -78,7 +78,7 @@ def generate_el_genesis_data(
exec(launcher_service_id, dir_creation_cmd, SUCCESSFUL_EXEC_CMD_EXIT_CODE)
genesis_config_filepath_on_generator = path_join(CONFIG_DIRPATH_ON_GENERATOR, GENESIS_CONFIG_FILENAME)
genesis_filename_to_relative_filepath_in_artifact = map[string]string{}
genesis_filename_to_relative_filepath_in_artifact = {}
for output_filename, generation_cmd in all_genesis_generation_cmds.items():
cmd = generation_cmd(genesis_config_filepath_on_generator)
output_filepath_on_generator = path_join(OUTPUT_DIRPATH_ON_GENERATOR, output_filename)
......
......@@ -2,7 +2,9 @@ def new_template_and_data(template, template_data_json):
return {"template": template, "template_data_json": template_data_json}
def path_join(*args):
joined_path = "/".join(*args)
joined_path = "/".join(args)
# TODO remove this
print(joined_path)
return joined_path.replace("//", "/")
def path_base(path):
......
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