diff --git a/README.md b/README.md index 8cacf4c4d..6c7a57d99 100644 --- a/README.md +++ b/README.md @@ -209,15 +209,26 @@ To configure the package behaviour, you can modify your `network_params.json` fi "tx_spammer_extra_args": [] }, - // True by defaults such that in addition to the Ethereum network: - // - A transaction spammer is launched to fake transactions sent to the network - // - Forkmon will be launched after CL genesis has happened - // - A prometheus will be started, coupled with grafana + // True by defaults, adds services defined in "additional_services" alongside the Ethereum network // If set to false: // - only Ethereum network (EL and CL nodes) will be launched. Nothing else (no transaction spammer) // - params for the CL nodes will be ignored (e.g. CL node image, CL node extra params) "launch_additional_services": true, + // By default includes + // - A transaction spammer is launched to fake transactions sent to the network + // - Forkmon will be launched after CL genesis has happened + // - A prometheus will be started, coupled with grafana + "additional_services": [ + "tx_spammer", + "blob_spammer", + "cl_forkmon", + "el_forkmon", + "beacon_metrics_gazer", + "light_beaconchain_explorer", + "prometheus_grafana", + ], + // If set, the package will block until a finalized epoch has occurred. "wait_for_finalization": false, diff --git a/main.star b/main.star index a201d5d1d..676d14519 100644 --- a/main.star +++ b/main.star @@ -215,95 +215,97 @@ def run(plan, args={}): if not args_with_right_defaults.launch_additional_services: return + for additional_service in args_with_right_defaults.additional_services: + if additional_service == "tx_spammer": + plan.print("Launching transaction spammer") + tx_spammer_params = args_with_right_defaults.tx_spammer_params + transaction_spammer.launch_transaction_spammer( + plan, + genesis_constants.PRE_FUNDED_ACCOUNTS, + all_el_client_contexts[0], + tx_spammer_params, + ) + plan.print("Succesfully launched transaction spammer") + elif additional_service == "blob_spammer": + plan.print("Launching Blob spammer") + blob_spammer.launch_blob_spammer( + plan, + genesis_constants.PRE_FUNDED_ACCOUNTS, + all_el_client_contexts[0], + all_cl_client_contexts[0], + network_params.deneb_fork_epoch, + network_params.seconds_per_slot, + network_params.slots_per_epoch, + network_params.genesis_delay, + ) + plan.print("Succesfully launched blob spammer") + # We need a way to do time.sleep + # TODO add code that waits for CL genesis + elif additional_service == "cl_forkmon": + plan.print("Launching cl forkmon") + cl_forkmon_config_template = read_file( + static_files.CL_FORKMON_CONFIG_TEMPLATE_FILEPATH + ) + cl_forkmon.launch_cl_forkmon( + plan, + cl_forkmon_config_template, + all_cl_client_contexts, + cl_genesis_timestamp, + network_params.seconds_per_slot, + network_params.slots_per_epoch, + ) + plan.print("Succesfully launched consensus layer forkmon") + elif additional_service == "el_forkmon": + plan.print("Launching el forkmon") + el_forkmon_config_template = read_file( + static_files.EL_FORKMON_CONFIG_TEMPLATE_FILEPATH + ) + el_forkmon.launch_el_forkmon( + plan, el_forkmon_config_template, all_el_client_contexts + ) + plan.print("Succesfully launched execution layer forkmon") + elif additional_service == "beacon_metrics_gazer": + plan.print("Launching beacon metrics gazer") + beacon_metrics_gazer_config_template = read_file( + static_files.BEACON_METRICS_GAZER_CONFIG_TEMPLATE_FILEPATH + ) + beacon_metrics_gazer.launch_beacon_metrics_gazer( + plan, + beacon_metrics_gazer_config_template, + all_cl_client_contexts, + args_with_right_defaults.participants, + network_params, + ) + plan.print("Succesfully launched beacon metrics gazer") + elif additional_service == "light_beaconchain_explorer": + plan.print("Launching light-beaconchain-explorer") + light_beaconchain_explorer_config_template = read_file( + static_files.LIGHT_BEACONCHAIN_CONFIG_TEMPLATE_FILEPATH + ) + light_beaconchain_explorer.launch_light_beacon( + plan, light_beaconchain_explorer_config_template, all_cl_client_contexts + ) + plan.print("Succesfully light-beaconchain-explorer") + elif additional_service == "prometheus_grafana": + plan.print("Launching prometheus...") + prometheus_private_url = prometheus.launch_prometheus( + plan, + prometheus_config_template, + all_cl_client_contexts, + all_el_client_contexts, + ) + plan.print("Successfully launched Prometheus") - plan.print("Launching transaction spammer") - tx_spammer_params = args_with_right_defaults.tx_spammer_params - transaction_spammer.launch_transaction_spammer( - plan, - genesis_constants.PRE_FUNDED_ACCOUNTS, - all_el_client_contexts[0], - tx_spammer_params, - ) - plan.print("Succesfully launched transaction spammer") - - plan.print("Launching Blob spammer") - blob_spammer.launch_blob_spammer( - plan, - genesis_constants.PRE_FUNDED_ACCOUNTS, - all_el_client_contexts[0], - all_cl_client_contexts[0], - network_params.deneb_fork_epoch, - network_params.seconds_per_slot, - network_params.slots_per_epoch, - network_params.genesis_delay, - ) - plan.print("Succesfully launched blob spammer") - - # We need a way to do time.sleep - # TODO add code that waits for CL genesis - - plan.print("Launching cl forkmon") - cl_forkmon_config_template = read_file( - static_files.CL_FORKMON_CONFIG_TEMPLATE_FILEPATH - ) - cl_forkmon.launch_cl_forkmon( - plan, - cl_forkmon_config_template, - all_cl_client_contexts, - cl_genesis_timestamp, - network_params.seconds_per_slot, - network_params.slots_per_epoch, - ) - plan.print("Succesfully launched consensus layer forkmon") - - plan.print("Launching el forkmon") - el_forkmon_config_template = read_file( - static_files.EL_FORKMON_CONFIG_TEMPLATE_FILEPATH - ) - el_forkmon.launch_el_forkmon( - plan, el_forkmon_config_template, all_el_client_contexts - ) - plan.print("Succesfully launched execution layer forkmon") - - plan.print("Launching beacon metrics gazer") - beacon_metrics_gazer_config_template = read_file( - static_files.BEACON_METRICS_GAZER_CONFIG_TEMPLATE_FILEPATH - ) - beacon_metrics_gazer.launch_beacon_metrics_gazer( - plan, - beacon_metrics_gazer_config_template, - all_cl_client_contexts, - args_with_right_defaults.participants, - network_params, - ) - plan.print("Succesfully launched beacon metrics gazer") - - plan.print("Launching light-beaconchain-explorer") - light_beaconchain_explorer_config_template = read_file( - static_files.LIGHT_BEACONCHAIN_CONFIG_TEMPLATE_FILEPATH - ) - light_beaconchain_explorer.launch_light_beacon( - plan, light_beaconchain_explorer_config_template, all_cl_client_contexts - ) - plan.print("Succesfully light-beaconchain-explorer") - - plan.print("Launching prometheus...") - prometheus_private_url = prometheus.launch_prometheus( - plan, - prometheus_config_template, - all_cl_client_contexts, - all_el_client_contexts, - ) - plan.print("Successfully launched Prometheus") - - plan.print("Launching grafana...") - grafana.launch_grafana( - plan, - grafana_datasource_config_template, - grafana_dashboards_config_template, - prometheus_private_url, - ) - plan.print("Succesfully launched grafana") + plan.print("Launching grafana...") + grafana.launch_grafana( + plan, + grafana_datasource_config_template, + grafana_dashboards_config_template, + prometheus_private_url, + ) + plan.print("Succesfully launched grafana") + else: + fail("Invalid additional service %s" % (additional_service)) if args_with_right_defaults.wait_for_finalization: plan.print("Waiting for the first finalized epoch") diff --git a/src/package_io/parse_input.star b/src/package_io/parse_input.star index 7c18efc48..fa55e7890 100644 --- a/src/package_io/parse_input.star +++ b/src/package_io/parse_input.star @@ -1,6 +1,15 @@ # MEV Params FLASHBOTS_MEV_BOOST_PORT = 18550 MEV_BOOST_SERVICE_NAME_PREFIX = "mev-boost-" +DEFAULT_ADDITIONAL_SERVICES = [ + "tx_spammer", + "blob_spammer", + "cl_forkmon", + "el_forkmon", + "beacon_metrics_gazer", + "light_beaconchain_explorer", + "prometheus_grafana", +] ATTR_TO_BE_SKIPPED_AT_ROOT = ( "network_params", @@ -34,6 +43,7 @@ def parse_input(plan, input_args): result["mev_type"] = None result["mev_params"] = get_default_mev_params() result["launch_additional_services"] = True + result["additional_services"] = DEFAULT_ADDITIONAL_SERVICES for attr in input_args: value = input_args[attr] @@ -119,6 +129,7 @@ def parse_input(plan, input_args): ], ), launch_additional_services=result["launch_additional_services"], + additional_services=result["additional_services"], wait_for_finalization=result["wait_for_finalization"], global_client_log_level=result["global_client_log_level"], mev_type=result["mev_type"],