Commit e3307078 authored by Gyanendra Mishra's avatar Gyanendra Mishra

cleanups abound

parent 0ec15186
...@@ -6,8 +6,8 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https: ...@@ -6,8 +6,8 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https:
### Parity Missing Tasks ### Parity Missing Tasks
- [ ] main.star - [x] main.star
- [ ] launch forkmon, prometheus, grafana, testnet_verifier, transaction_spammer - [x] launch forkmon, prometheus, grafana, testnet_verifier, transaction_spammer
- [x] Module IO (this is blocked on Startosis Args working) - [x] Module IO (this is blocked on Startosis Args working)
- [x] forkmon (this is blocked on CL clients running) - [x] forkmon (this is blocked on CL clients running)
- [x] prometheus (this is blocked on CL clients running) - [x] prometheus (this is blocked on CL clients running)
...@@ -35,8 +35,8 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https: ...@@ -35,8 +35,8 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https:
- [ ] erigon - [ ] erigon
- [ ] facts and waits + private_ip_address_placeholder - [ ] facts and waits + private_ip_address_placeholder
- [x] framework - [x] framework
- [ ] geth DEMO - [x] geth DEMO
- [ ] facts and waits + private_ip_address_placeholder - [x] facts and waits + private_ip_address_placeholder
- [x] framework TESTED - [x] framework TESTED
- [ ] nethermind - [ ] nethermind
- [ ] facts and waits + private_ip_address_placeholder - [ ] facts and waits + private_ip_address_placeholder
......
...@@ -7,9 +7,16 @@ load("github.com/kurtosis-tech/eth2-module/src/participant_network/prelaunch_dat ...@@ -7,9 +7,16 @@ load("github.com/kurtosis-tech/eth2-module/src/participant_network/prelaunch_dat
load("github.com/kurtosis-tech/eth2-module/src/transaction_spammer/transaction_spammer.star", "launch_transaction_spammer") load("github.com/kurtosis-tech/eth2-module/src/transaction_spammer/transaction_spammer.star", "launch_transaction_spammer")
load("github.com/kurtosis-tech/eth2-module/src/forkmon/forkmon_launcher.star", "launch_forkmon") load("github.com/kurtosis-tech/eth2-module/src/forkmon/forkmon_launcher.star", "launch_forkmon")
load("github.com/kurtosis-tech/eth2-module/src/prometheus/prometheus_launcher.star", "launch_prometheus") load("github.com/kurtosis-tech/eth2-module/src/prometheus/prometheus_launcher.star", "launch_prometheus")
load("github.com/kurtosis-tech/eth2-module/src/grafana/grafana_launcher.star", "launch_grafana")
load("github.com/kurtosis-tech/eth2-module/src/testnet_verifier/testnet_verifier.star", "run_synchronous_testnet_verification", "launch_testnet_verifier")
module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto") module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto")
GRAFANA_USER = "admin"
GRAFANA_PASSWORD = "admin"
GRAFANA_DASHBOARD_PATH_URL = "/d/QdTOwy-nz/eth2-merge-kurtosis-module-dashboard?orgId=1"
def main(input_args): 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)
...@@ -56,13 +63,34 @@ def main(input_args): ...@@ -56,13 +63,34 @@ def main(input_args):
) )
print("Successfully launched Prometheus") print("Successfully launched Prometheus")
print("Launching grafana...")
launch_grafana(grafana_datasource_config_template, grafana_dashboards_config_template, prometheus_private_url)
print("Succesfully launched grafana")
if input_args_with_right_defaults.wait_for_verifications:
print("Running synchrnous testnet verifier")
# As we don't get the verification output we can't print it
# TODO verify if this behavior is okay
run_synchronous_testnet_verification(input_args_with_right_defaults, all_el_client_contexts, all_cl_client_contexts)
print("Verification succeeded")
else:
print("Running asynchronous verification")
launch_testnet_verifier(input_args_with_right_defaults, all_el_client_contexts, all_cl_client_contexts)
print("Succesfully launched asynchronous verifier")
if input_args_with_right_defaults.wait_for_finalization:
print("Waiting for the first finalized epoch")
first_cl_client = all_cl_client_contexts[0]
# TODO add fact and wait to emulate this behavior
print("First finalized epoch occurred successfully")
grafana_info = module_io.GrafanaInfo( grafana_info = module_io.GrafanaInfo(
dashboard_path = "dummy_path", dashboard_path = GRAFANA_DASHBOARD_PATH_URL,
user = "user", user = GRAFANA_USER,
password = "password" password = GRAFANA_PASSWORD
) )
output = module_io.ModuleOutput({"grafana_info": grafana_info}) output = module_io.ModuleOutput(grafana_info = grafana_info)
print(output)
return output return output
...@@ -28,7 +28,7 @@ USED_PORTS = { ...@@ -28,7 +28,7 @@ USED_PORTS = {
def launch_grafana(datasource_config_template, dashboard_providers_config_template, prometheus_private_url): def launch_grafana(datasource_config_template, dashboard_providers_config_template, prometheus_private_url):
grafana_config_artifacts_uuid, grafana_dashboards_uuid = get_grafana_config_dir_artifact_uuid(datasource_config_template, dashboard_providers_config_template, prometheus_private_url) grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid = get_grafana_config_dir_artifact_uuid(datasource_config_template, dashboard_providers_config_template, prometheus_private_url)
service_config = get_service_config(grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid) service_config = get_service_config(grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid)
...@@ -55,9 +55,21 @@ def get_grafana_config_dir_artifact_uuid(datasource_config_template, dashboard_p ...@@ -55,9 +55,21 @@ def get_grafana_config_dir_artifact_uuid(datasource_config_template, dashboard_p
return grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid return grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid
def get_service_config(grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid):
return struct(
container_image_name = IMAGE_NAME,
used_ports = USED_PORTS,
env_vars = {CONFIG_DIRPATH_ENV_VAR: GRAFANA_CONFIG_DIRPATH_ON_SERVICE},
files_artifact_mount_dirpaths = {
grafana_config_artifacts_uuid : GRAFANA_CONFIG_DIRPATH_ON_SERVICE,
grafana_dashboards_artifacts_uuid: GRAFANA_DASHBOARDS_DIRPATH_ON_SERVICE
}
)
def new_datasource_config_template_data(prometheus_url): def new_datasource_config_template_data(prometheus_url):
return { return {
"PromtehusURL": prometheus_url "PrometheusURL": prometheus_url
} }
......
...@@ -2,10 +2,10 @@ IMAGE_NAME = "marioevz/merge-testnet-verifier:latest" ...@@ -2,10 +2,10 @@ IMAGE_NAME = "marioevz/merge-testnet-verifier:latest"
SERVICE_ID = "testnet-verifier" SERVICE_ID = "testnet-verifier"
# We use Docker exec commands to run the commands we need, so we override the default # We use Docker exec commands to run the commands we need, so we override the default
SYNCHRONOUS_ENTRYPOINT_ARGS = { SYNCHRONOUS_ENTRYPOINT_ARGS = [
"sleep", "sleep",
"999999", "999999",
} ]
# this is broken check - https://github.com/ethereum/merge-testnet-verifier/issues/4 # this is broken check - https://github.com/ethereum/merge-testnet-verifier/issues/4
...@@ -18,7 +18,7 @@ def run_synchronous_testnet_verification(params, el_client_contexts, cl_client_c ...@@ -18,7 +18,7 @@ def run_synchronous_testnet_verification(params, el_client_contexts, cl_client_c
service_config = get_synchronous_verification_service_config() service_config = get_synchronous_verification_service_config()
add_service(SERVICE_ID, service_config) add_service(SERVICE_ID, service_config)
command = get_cmd() command = get_cmd(params, el_client_contexts, cl_client_contexts, True)
exec(SERVICE_ID, command) exec(SERVICE_ID, command)
...@@ -28,7 +28,8 @@ def get_cmd(params, el_client_contexts, cl_client_contexts, add_binary_name): ...@@ -28,7 +28,8 @@ def get_cmd(params, el_client_contexts, cl_client_contexts, add_binary_name):
if add_binary_name: if add_binary_name:
command.append("./merge_testnet_verifier") command.append("./merge_testnet_verifier")
command.append("--ttd 0") command.append("--ttd")
command.append("0")
for el_client_context in el_client_contexts: for el_client_context in el_client_contexts:
command.append("--client") command.append("--client")
...@@ -38,16 +39,18 @@ def get_cmd(params, el_client_contexts, cl_client_contexts, add_binary_name): ...@@ -38,16 +39,18 @@ def get_cmd(params, el_client_contexts, cl_client_contexts, add_binary_name):
command.append("--client") command.append("--client")
command.append("{0},http://{1}:{2}".format(cl_client_context.client_name, cl_client_context.ip_addr, cl_client_context.http_port_num)) command.append("{0},http://{1}:{2}".format(cl_client_context.client_name, cl_client_context.ip_addr, cl_client_context.http_port_num))
command.append("--ttd-epoch-limit 0") command.append("--ttd-epoch-limit")
command.append("0")
command.append("--verif-epoch-limit") command.append("--verif-epoch-limit")
# TODO make this an actual param command.append("{0}".format(params.verifications_epoch_limit))
command.append("{0}".fomrat(param.verifications_epoch_limit))
return command
def get_asynchronous_verification_service_config(params, el_client_contexts, cl_client_contexts): def get_asynchronous_verification_service_config(params, el_client_contexts, cl_client_contexts):
commands = get_cmd(params, el_client_contexts, cl_client_contexts) commands = get_cmd(params, el_client_contexts, cl_client_contexts, False)
return struct( return struct(
container_image_name = IMAGE_NAME, container_image_name = IMAGE_NAME,
cmd_args = commands, cmd_args = commands,
...@@ -59,7 +62,7 @@ def get_asynchronous_verification_service_config(params, el_client_contexts, cl_ ...@@ -59,7 +62,7 @@ def get_asynchronous_verification_service_config(params, el_client_contexts, cl_
def get_synchronous_verification_service_config(): def get_synchronous_verification_service_config():
return struct( return struct(
container_image_name = IMAGE_NAME, container_image_name = IMAGE_NAME,
entry_point_args = ENTRYPOINT_ARGS, entry_point_args = SYNCHRONOUS_ENTRYPOINT_ARGS,
# TODO remove this when used_ports is optional in add_service # TODO remove this when used_ports is optional in add_service
used_ports = {}, used_ports = {},
) )
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