Commit 9f319ceb authored by Gyanendra Mishra's avatar Gyanendra Mishra

better

parent 1b82e6df
...@@ -7,7 +7,7 @@ def main(input_args): ...@@ -7,7 +7,7 @@ def main(input_args):
input_args_with_right_defaults = module_io.ModuleInput(parse_input(input_args)) input_args_with_right_defaults = module_io.ModuleInput(parse_input(input_args))
num_participants = len(input_args_with_right_defaults.participants) num_participants = len(input_args_with_right_defaults.participants)
print("Launching participant network with {0} participants and the following network params {1}".format(num_participants, input_args_with_right_defaults.network_params)) print("Launching participant network with {0} participants and the following network params {1}".format(num_participants, input_args_with_right_defaults.network_params))
all_participants, cl_gensis_timestamp = launch_participant_network(input_args_with_right_defaults.participants, input_args_with_right_defaults.network_params, input_args_with_right_defaults.global_log_level) all_participants, cl_gensis_timestamp = launch_participant_network(input_args_with_right_defaults.participants, input_args_with_right_defaults.network_params, input_args_with_right_defaults.global_client_log_level)
print(all_participants) print(all_participants)
print(cl_gensis_timestamp) print(cl_gensis_timestamp)
grafana_info = module_io.GrafanaInfo( grafana_info = module_io.GrafanaInfo(
......
load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join", "path_dir") load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join", "path_dir")
load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default") load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default")
load("github.com/kurtosis-tech/eth2-module/src/cl/cl_client_context.star", "new_cl_client_context") load("github.com/kurtosis-tech/eth2-module/src/participant_network/cl/cl_client_context.star", "new_cl_client_context")
load("github.com/kurtosis-tech/eth2-module/src/cl/cl_node_metrics_info.star", "new_cl_node_metrics_info") load("github.com/kurtosis-tech/eth2-module/src/participant_network/cl/cl_node_metrics_info.star", "new_cl_node_metrics_info")
load("github.com/kurtosis-tech/eth2-module/src/mev_boost/mev_boost_context.star", "mev_boost_endpoint") load("github.com/kurtosis-tech/eth2-module/src/participant_network/mev_boost/mev_boost_context.star", "mev_boost_endpoint")
module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto") module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto")
...@@ -66,8 +66,8 @@ VALIDATOR_USED_PORTS = { ...@@ -66,8 +66,8 @@ VALIDATOR_USED_PORTS = {
LIGHTHOUSE_LOG_LEVELS = { LIGHTHOUSE_LOG_LEVELS = {
module_io.GlobalClientLogLevel.error: "error", module_io.GlobalClientLogLevel.error: "error",
module_io.GlobalClientLogLeve.warn: "warn", module_io.GlobalClientLogLevel.warn: "warn",
module_io.GlobalClientLogLeve.info: "info", module_io.GlobalClientLogLevel.info: "info",
module_io.GlobalClientLogLevel.debug: "debug", module_io.GlobalClientLogLevel.debug: "debug",
module_io.GlobalClientLogLevel.trace: "trace", module_io.GlobalClientLogLevel.trace: "trace",
} }
...@@ -149,11 +149,11 @@ def launch( ...@@ -149,11 +149,11 @@ def launch(
def get_beacon_service_config( def get_beacon_service_config(
genesis_data, genesis_data,
image image,
boot_cl_client_ctx, boot_cl_client_ctx,
el_client_ctx, el_client_ctx,
mev_boost_context, mev_boost_context,
log_level log_level,
extra_params): extra_params):
el_client_engine_rpc_url_str = "http://%v:%v".format( el_client_engine_rpc_url_str = "http://%v:%v".format(
...@@ -216,9 +216,8 @@ def get_beacon_service_config( ...@@ -216,9 +216,8 @@ def get_beacon_service_config(
cmd_args.append(mev_boost_endpoint(mev_boost_context)) cmd_args.append(mev_boost_endpoint(mev_boost_context))
if len(extra_params) > 0 { if len(extra_params) > 0:
cmd_args.extend(extra_params) cmd_args.extend(extra_params)
}
return struct( return struct(
container_image_name = image, container_image_name = image,
...@@ -244,7 +243,7 @@ def get_validator_service_config( ...@@ -244,7 +243,7 @@ def get_validator_service_config(
extra_params): extra_params):
# For some reason, Lighthouse takes in the parent directory of the config file (rather than the path to the config file itself) # For some reason, Lighthouse takes in the parent directory of the config file (rather than the path to the config file itself)
genesis_config_parent_dirpath_on_client = path_join(GENESIS_DATA_MOUNTPOINT_ON_CLIENTS, path_dir(launcher.genesisData.GetConfigYMLRelativeFilepath())) genesis_config_parent_dirpath_on_client = path_join(GENESIS_DATA_MOUNTPOINT_ON_CLIENTS, path_dir(genesis_data.config_yml_rel_filepath))
validator_keys_dirpath = path_join(VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS, node_keystore_files.RawKeysRelativeDirpath) validator_keys_dirpath = path_join(VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS, node_keystore_files.RawKeysRelativeDirpath)
validator_secrets_dirpath = path_join(VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS, node_keystore_files.RawSecretsRelativeDirpath) validator_secrets_dirpath = path_join(VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS, node_keystore_files.RawSecretsRelativeDirpath)
...@@ -296,7 +295,7 @@ def get_validator_service_config( ...@@ -296,7 +295,7 @@ def get_validator_service_config(
def new_lighthouses_launcher(cl_genesi_data): def new_lighthouse_launcher(cl_genesi_data):
return struct( return struct(
cl_genesi_data = cl_genesi_data, cl_genesi_data = cl_genesi_data,
) )
\ No newline at end of file
load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join", "path_dir") load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join", "path_dir")
load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default") load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default")
load("github.com/kurtosis-tech/eth2-module/src/cl/cl_client_context.star", "new_cl_client_context") load("github.com/kurtosis-tech/eth2-module/src/participant_network/cl/cl_client_context.star", "new_cl_client_context")
load("github.com/kurtosis-tech/eth2-module/src/cl/cl_node_metrics_info.star", "new_cl_node_metrics_info") load("github.com/kurtosis-tech/eth2-module/src/participant_network/cl/cl_node_metrics_info.star", "new_cl_node_metrics_info")
load("github.com/kurtosis-tech/eth2-module/src/mev_boost/mev_boost_context.star", "mev_boost_endpoint") load("github.com/kurtosis-tech/eth2-module/src/participant_network/mev_boost/mev_boost_context.star", "mev_boost_endpoint")
module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto") module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto")
...@@ -51,8 +51,8 @@ USED_PORTS = { ...@@ -51,8 +51,8 @@ USED_PORTS = {
LOADSTAR_LOG_LEVELS = { LOADSTAR_LOG_LEVELS = {
module_io.GlobalClientLogLevel.error: "error", module_io.GlobalClientLogLevel.error: "error",
module_io.GlobalClientLogLeve.warn: "warn", module_io.GlobalClientLogLevel.warn: "warn",
module_io.GlobalClientLogLeve.info: "info", module_io.GlobalClientLogLevel.info: "info",
module_io.GlobalClientLogLevel.debug: "debug", module_io.GlobalClientLogLevel.debug: "debug",
module_io.GlobalClientLogLevel.trace: "trace", module_io.GlobalClientLogLevel.trace: "trace",
} }
......
load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join") load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join")
load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default") load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default")
load("github.com/kurtosis-tech/eth2-module/src/el/el_client_context.star", "new_el_client_context") load("github.com/kurtosis-tech/eth2-module/src/participant_network/el/el_client_context.star", "new_el_client_context")
module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto") module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto")
...@@ -47,8 +47,8 @@ ENTRYPOINT_ARGS = ["sh", "-c"] ...@@ -47,8 +47,8 @@ ENTRYPOINT_ARGS = ["sh", "-c"]
BESU_LOG_LEVELS = { BESU_LOG_LEVELS = {
module_io.GlobalClientLogLevel.error: "ERROR", module_io.GlobalClientLogLevel.error: "ERROR",
module_io.GlobalClientLogLeve.warn: "WARN", module_io.GlobalClientLogLevel.warn: "WARN",
module_io.GlobalClientLogLeve.info: "INFO", module_io.GlobalClientLogLevel.info: "INFO",
module_io.GlobalClientLogLevel.debug: "DEBUG", module_io.GlobalClientLogLevel.debug: "DEBUG",
module_io.GlobalClientLogLevel.trace: "TRACE", module_io.GlobalClientLogLevel.trace: "TRACE",
} }
......
load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join") load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join")
load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default") load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default")
load("github.com/kurtosis-tech/eth2-module/src/el/el_client_context.star", "new_el_client_context") load("github.com/kurtosis-tech/eth2-module/src/participant_network/el/el_client_context.star", "new_el_client_context")
module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto") module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto")
...@@ -46,8 +46,8 @@ ENTRYPOINT_ARGS = ["sh", "-c"] ...@@ -46,8 +46,8 @@ ENTRYPOINT_ARGS = ["sh", "-c"]
ERIGON_LOG_LEVELS = { ERIGON_LOG_LEVELS = {
module_io.GlobalClientLogLevel.error: "1", module_io.GlobalClientLogLevel.error: "1",
module_io.GlobalClientLogLeve.warn: "2", module_io.GlobalClientLogLevel.warn: "2",
module_io.GlobalClientLogLeve.info: "3", module_io.GlobalClientLogLevel.info: "3",
module_io.GlobalClientLogLevel.debug: "4", module_io.GlobalClientLogLevel.debug: "4",
module_io.GlobalClientLogLevel.trace: "5", module_io.GlobalClientLogLevel.trace: "5",
} }
......
load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join") load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join")
load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default") load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default")
load("github.com/kurtosis-tech/eth2-module/src/el/el_client_context.star", "new_el_client_context") load("github.com/kurtosis-tech/eth2-module/src/participant_network/el/el_client_context.star", "new_el_client_context")
module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto") module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto")
...@@ -33,7 +33,7 @@ KEYSTORE_DIRPATH_ON_CLIENT_CONTAINER = EXECUTION_DATA_DIRPATH_ON_CLIENT_CON ...@@ -33,7 +33,7 @@ KEYSTORE_DIRPATH_ON_CLIENT_CONTAINER = EXECUTION_DATA_DIRPATH_ON_CLIENT_CON
EXPECTED_SECONDS_FOR_GETH_INIT = 10 EXPECTED_SECONDS_FOR_GETH_INIT = 10
EXPECTED_SECONDS_PER_KEY_IMPORT = 8 EXPECTED_SECONDS_PER_KEY_IMPORT = 8
EXPECTED_SECONDS_AFTER_NODE_START_UNTIL_HTTP_SERVER_IS_AVAILABLE = 20 EXPECTED_SECONDS_AFTER_NODE_START_UNTIL_HTTP_SERVER_IS_AVAILABLE = 20
GET_NODE_INFO_TIME_BETWEEN_RETRIES = 1 * time.Second GET_NODE_INFO_TIME_BETWEEN_RETRIES = 1 * time.second
GETH_ACCOUNT_PASSWORD = "password" # Password that the Geth accounts will be locked with GETH_ACCOUNT_PASSWORD = "password" # Password that the Geth accounts will be locked with
GETH_ACCOUNT_PASSWORDS_FILE = "/tmp/password.txt" # Importing an account to GETH_ACCOUNT_PASSWORDS_FILE = "/tmp/password.txt" # Importing an account to
...@@ -56,8 +56,8 @@ ENTRYPOINT_ARGS = ["sh", "-c"] ...@@ -56,8 +56,8 @@ ENTRYPOINT_ARGS = ["sh", "-c"]
VERBOSITY_LEVELS = { VERBOSITY_LEVELS = {
module_io.GlobalClientLogLevel.error: "1", module_io.GlobalClientLogLevel.error: "1",
module_io.GlobalClientLogLeve.warn: "2", module_io.GlobalClientLogLevel.warn: "2",
module_io.GlobalClientLogLeve.info: "3", module_io.GlobalClientLogLevel.info: "3",
module_io.GlobalClientLogLevel.debug: "4", module_io.GlobalClientLogLevel.debug: "4",
module_io.GlobalClientLogLevel.trace: "5", module_io.GlobalClientLogLevel.trace: "5",
} }
...@@ -73,7 +73,7 @@ def launch( ...@@ -73,7 +73,7 @@ def launch(
extra_params): extra_params):
log_level = get_client_log_level_or_default(participant_log_level, global_log_level, ERIGON_LOG_LEVELS) log_level = get_client_log_level_or_default(participant_log_level, global_log_level, VERBOSITY_LEVELS)
service_config = get_service_config(launcher.network_id, launcher.el_genesis_data, launcher.prefunded_geth_keys_artifact_uuid, service_config = get_service_config(launcher.network_id, launcher.el_genesis_data, launcher.prefunded_geth_keys_artifact_uuid,
launcher.prefunded_account_info, image, existing_el_clients, log_level, extra_params) launcher.prefunded_account_info, image, existing_el_clients, log_level, extra_params)
...@@ -123,7 +123,7 @@ def get_service_config(network_id, genesis_data, prefunded_geth_keys_artifact_uu ...@@ -123,7 +123,7 @@ def get_service_config(network_id, genesis_data, prefunded_geth_keys_artifact_uu
launch_node_cmd_args = [ launch_node_cmd_args = [
"geth", "geth",
"--verbosity=" + verbosityLevel, "--verbosity=" + verbosity_level,
"--unlock=" + accounts_to_unlock_str, "--unlock=" + accounts_to_unlock_str,
"--password=" + GETH_ACCOUNT_PASSWORDS_FILE, "--password=" + GETH_ACCOUNT_PASSWORDS_FILE,
"--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, "--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER,
...@@ -142,7 +142,7 @@ def get_service_config(network_id, genesis_data, prefunded_geth_keys_artifact_uu ...@@ -142,7 +142,7 @@ def get_service_config(network_id, genesis_data, prefunded_geth_keys_artifact_uu
"--ws.origins=*", "--ws.origins=*",
"--allow-insecure-unlock", "--allow-insecure-unlock",
"--nat=extip:" + PRIVATE_IP_ADDRESS_PLACEHOLDER, "--nat=extip:" + PRIVATE_IP_ADDRESS_PLACEHOLDER,
"--verbosity=" + verbosityLevel, "--verbosity=" + verbosity_level,
"--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM), "--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM),
"--authrpc.addr=0.0.0.0", "--authrpc.addr=0.0.0.0",
"--authrpc.vhosts=*", "--authrpc.vhosts=*",
...@@ -151,19 +151,17 @@ def get_service_config(network_id, genesis_data, prefunded_geth_keys_artifact_uu ...@@ -151,19 +151,17 @@ def get_service_config(network_id, genesis_data, prefunded_geth_keys_artifact_uu
] ]
bootnode_enode = "" bootnode_enode = ""
if len(existing_el_clients) > 0 { if len(existing_el_clients) > 0:
bootnode_context = existing_el_clients[0] bootnode_context = existing_el_clients[0]
bootnode_enode = bootnode_context.enode bootnode_enode = bootnode_context.enode
}
launch_node_cmd_args.append( launch_node_cmd_args.append(
launch_node_cmd_args, launch_node_cmd_args,
'--bootnodes="%s"'.format(bootnode_enode), '--bootnodes="%s"'.format(bootnode_enode),
) )
if len(extraParams) > 0 { if len(extra_params) > 0:
launch_node_cmd_args.extend(extraParams) launch_node_cmd_args.extend(extra_params)
}
launch_node_cmd_str = " ".join(launch_node_cmd_args) launch_node_cmd_str = " ".join(launch_node_cmd_args)
...@@ -175,8 +173,6 @@ def get_service_config(network_id, genesis_data, prefunded_geth_keys_artifact_uu ...@@ -175,8 +173,6 @@ def get_service_config(network_id, genesis_data, prefunded_geth_keys_artifact_uu
] ]
command_str = " && ".join(subcommand_strs) command_str = " && ".join(subcommand_strs)
return struct( return struct(
container_image_name = image, container_image_name = image,
used_ports = USED_PORTS, used_ports = USED_PORTS,
......
load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join") load("github.com/kurtosis-tech/eth2-module/src/shared_utils/shared_utils.star", "new_port_spec", "path_join")
load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default") load("github.com/kurtosis-tech/eth2-module/src/module_io/parse_input.star", "get_client_log_level_or_default")
load("github.com/kurtosis-tech/eth2-module/src/el/el_client_context.star", "new_el_client_context") load("github.com/kurtosis-tech/eth2-module/src/participant_network/el/el_client_context.star", "new_el_client_context")
module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto") module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto")
...@@ -42,8 +42,8 @@ USED_PORTS = { ...@@ -42,8 +42,8 @@ USED_PORTS = {
NETHERMIND_LOG_LEVELS = { NETHERMIND_LOG_LEVELS = {
module_io.GlobalClientLogLevel.error: "ERROR", module_io.GlobalClientLogLevel.error: "ERROR",
module_io.GlobalClientLogLeve.warn: "WARN", module_io.GlobalClientLogLevel.warn: "WARN",
module_io.GlobalClientLogLeve.info: "INFO", module_io.GlobalClientLogLevel.info: "INFO",
module_io.GlobalClientLogLevel.debug: "DEBUG", module_io.GlobalClientLogLevel.debug: "DEBUG",
module_io.GlobalClientLogLevel.trace: "TRACE", module_io.GlobalClientLogLevel.trace: "TRACE",
} }
......
...@@ -71,7 +71,7 @@ def launch_participant_network(participants, network_params, global_log_level): ...@@ -71,7 +71,7 @@ def launch_participant_network(participants, network_params, global_log_level):
el_launchers = { el_launchers = {
# TODO Allow for other types here # TODO Allow for other types here
module_io.ELClientType.geth : {"launcher": new_geth_launcher(el_genesis_data, geth_prefunded_keys_artifact_id, PRE_FUNDED_ACCOUNTS, network_params.network_id), "launch_method": launch_geth} module_io.ELClientType.geth : {"launcher": new_geth_launcher(network_params.network_id, el_genesis_data, geth_prefunded_keys_artifact_id, PRE_FUNDED_ACCOUNTS), "launch_method": launch_geth}
} }
all_el_client_contexts = [] all_el_client_contexts = []
......
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