Skip to content

Commit

Permalink
feat: allow setting custom dora image & env variables (#623)
Browse files Browse the repository at this point in the history
Allow using a custom dora image and specifying custom env variables.
This is especially useful for early testnets that might need disabling
some features via ENV vars
(eg. `KILLSWITCH_DISABLE_SSZ_REQUESTS=true`,
`KILLSWITCH_DISABLE_SSZ_ENCODING=true`)
  • Loading branch information
pk910 committed May 17, 2024
1 parent 085b6e1 commit 08a65c3
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,15 @@ additional_services:
- blutgang
- apache

# Configuration place for dora the explorer - https:#github.com/ethpandaops/dora
dora_params:
# Dora docker image to use
# Leave blank to use the default image according to your network params
image: ""

# A list of optional extra env_vars the dora container should spin up with
env: {}

# Configuration place for transaction spammer - https:#github.com/MariusVanDerWijden/tx-fuzz
tx_spammer_params:
# A list of optional extra params that will be passed to the TX Spammer container for modifying its behaviour
Expand Down
2 changes: 2 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,15 @@ def run(plan, args={}):
elif additional_service == "dora":
plan.print("Launching dora")
dora_config_template = read_file(static_files.DORA_CONFIG_TEMPLATE_FILEPATH)
dora_params = args_with_right_defaults.dora_params
dora.launch_dora(
plan,
dora_config_template,
all_participants,
args_with_right_defaults.participants,
el_cl_data_files_artifact_uuid,
network_params,
dora_params,
global_node_selectors,
)
plan.print("Successfully launched dora")
Expand Down
2 changes: 2 additions & 0 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ additional_services:
- beacon_metrics_gazer
- dora
- prometheus_grafana
dora_params:
image: ""
tx_spammer_params:
tx_spammer_extra_args: []
goomy_blob_params:
Expand Down
8 changes: 7 additions & 1 deletion src/dora/dora_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def launch_dora(
participant_configs,
el_cl_data_files_artifact_uuid,
network_params,
dora_params,
global_node_selectors,
):
all_cl_client_info = []
Expand Down Expand Up @@ -76,6 +77,7 @@ def launch_dora(
config_files_artifact_name,
el_cl_data_files_artifact_uuid,
network_params,
dora_params,
global_node_selectors,
)

Expand All @@ -86,14 +88,17 @@ def get_config(
config_files_artifact_name,
el_cl_data_files_artifact_uuid,
network_params,
dora_params,
node_selectors,
):
config_file_path = shared_utils.path_join(
DORA_CONFIG_MOUNT_DIRPATH_ON_SERVICE,
DORA_CONFIG_FILENAME,
)

if network_params.eip7594_fork_epoch < 100000000:
if dora_params.image != "":
IMAGE_NAME = dora_params.image
elif network_params.eip7594_fork_epoch < 100000000:
IMAGE_NAME = "ethpandaops/dora:peer-das"
elif network_params.electra_fork_epoch < 100000000:
IMAGE_NAME = "ethpandaops/dora:electra-support"
Expand All @@ -111,6 +116,7 @@ def get_config(
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_data_files_artifact_uuid,
},
cmd=["-config", config_file_path],
env_vars=dora_params.env,
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
Expand Down
17 changes: 17 additions & 0 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ ATTR_TO_BE_SKIPPED_AT_ROOT = (
"network_params",
"participants",
"mev_params",
"dora_params",
"assertoor_params",
"goomy_blob_params",
"tx_spammer_params",
Expand All @@ -87,6 +88,7 @@ def input_parser(plan, input_args):
result = parse_network_params(plan, input_args)

# add default eth2 input params
result["dora_params"] = get_default_dora_params()
result["mev_params"] = get_default_mev_params(
result.get("mev_type"), result["network_params"]["preset"]
)
Expand Down Expand Up @@ -127,6 +129,10 @@ def input_parser(plan, input_args):
if attr not in ATTR_TO_BE_SKIPPED_AT_ROOT and attr in input_args:
result[attr] = value
# custom eth2 attributes config
elif attr == "dora_params":
for sub_attr in input_args["dora_params"]:
sub_value = input_args["dora_params"][sub_attr]
result["dora_params"][sub_attr] = sub_value
elif attr == "mev_params":
for sub_attr in input_args["mev_params"]:
sub_value = input_args["mev_params"][sub_attr]
Expand Down Expand Up @@ -309,6 +315,10 @@ def input_parser(plan, input_args):
)
if result["mev_params"]
else None,
dora_params=struct(
image=result["dora_params"]["image"],
env=result["dora_params"]["env"],
),
tx_spammer_params=struct(
tx_spammer_extra_args=result["tx_spammer_params"]["tx_spammer_extra_args"],
),
Expand Down Expand Up @@ -840,6 +850,13 @@ def default_participant():
}


def get_default_dora_params():
return {
"image": "",
"env": {},
}


def get_default_mev_params(mev_type, preset):
mev_relay_image = constants.DEFAULT_FLASHBOTS_RELAY_IMAGE
mev_builder_image = constants.DEFAULT_FLASHBOTS_BUILDER_IMAGE
Expand Down

0 comments on commit 08a65c3

Please sign in to comment.