Skip to content

Commit

Permalink
feat: add mev relays to dora config (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Jun 20, 2024
1 parent cb203ff commit 293001a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
7 changes: 7 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,16 @@ def run(plan, args={}):
)

mev_endpoints = []
mev_endpoint_names = []
# passed external relays get priority
# perhaps add mev_type External or remove this
if (
hasattr(participant, "builder_network_params")
and participant.builder_network_params != None
):
mev_endpoints = participant.builder_network_params.relay_end_points
for idx, mev_endpoint in enumerate(mev_endpoints):
mev_endpoint_names.append("relay-{0}".format(idx + 1))
# otherwise dummy relays spinup if chosen
elif (
args_with_right_defaults.mev_type
Expand All @@ -219,6 +222,7 @@ def run(plan, args={}):
global_node_selectors,
)
mev_endpoints.append(endpoint)
mev_endpoint_names.append(constants.MOCK_MEV_TYPE)
elif args_with_right_defaults.mev_type and (
args_with_right_defaults.mev_type == constants.FLASHBOTS_MEV_TYPE
or args_with_right_defaults.mev_type == constants.MEV_RS_MEV_TYPE
Expand Down Expand Up @@ -288,6 +292,7 @@ def run(plan, args={}):
normal_user.private_key,
)
mev_endpoints.append(endpoint)
mev_endpoint_names.append(args_with_right_defaults.mev_type)

# spin up the mev boost contexts if some endpoints for relays have been passed
all_mevboost_contexts = []
Expand Down Expand Up @@ -451,6 +456,8 @@ def run(plan, args={}):
network_params,
dora_params,
global_node_selectors,
mev_endpoints,
mev_endpoint_names,
)
plan.print("Successfully launched dora")
elif additional_service == "dugtrio":
Expand Down
27 changes: 22 additions & 5 deletions src/dora/dora_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def launch_dora(
network_params,
dora_params,
global_node_selectors,
mev_endpoints,
mev_endpoint_names,
):
all_cl_client_info = []
all_el_client_info = []
Expand All @@ -59,8 +61,22 @@ def launch_dora(
)
)

mev_endpoint_info = []
for index, endpoint in enumerate(mev_endpoints):
mev_endpoint_info.append(
{
"Index": index,
"Name": mev_endpoint_names[index],
"Url": endpoint,
}
)

template_data = new_config_template_data(
network_params.network, HTTP_PORT_NUMBER, all_cl_client_info, all_el_client_info
network_params.network,
HTTP_PORT_NUMBER,
all_cl_client_info,
all_el_client_info,
mev_endpoint_info,
)

template_and_data = shared_utils.new_template_and_data(
Expand Down Expand Up @@ -103,9 +119,7 @@ def get_config(
elif network_params.electra_fork_epoch < 100000000:
IMAGE_NAME = "ethpandaops/dora:electra-support"
else:
IMAGE_NAME = (
"ethpandaops/dora:master" # TODO: revert to latest after next dora release
)
IMAGE_NAME = "ethpandaops/dora:latest"

return ServiceConfig(
image=IMAGE_NAME,
Expand All @@ -125,12 +139,15 @@ def get_config(
)


def new_config_template_data(network, listen_port_num, cl_client_info, el_client_info):
def new_config_template_data(
network, listen_port_num, cl_client_info, el_client_info, mev_endpoint_info
):
return {
"Network": network,
"ListenPortNum": listen_port_num,
"CLClientInfo": cl_client_info,
"ELClientInfo": el_client_info,
"MEVRelayInfo": mev_endpoint_info,
"PublicNetwork": True if network in constants.PUBLIC_NETWORKS else False,
}

Expand Down
10 changes: 10 additions & 0 deletions static_files/dora-config/config.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ indexer:
# number of seconds to wait between each epoch (don't overload CL client)
syncEpochCooldown: 1

mevIndexer:
# list of mev relays to crawl mev blocks from
relays: {{ if not .MEVRelayInfo }}[]{{ end }}
{{ range $relay := .MEVRelayInfo }}
- index: {{ $relay.Index }}
name: "{{ $relay.Name }}"
url: "{{ $relay.Url }}"
{{- end }}
refreshInterval: 5m

database:
engine: "sqlite"
sqlite:
Expand Down

0 comments on commit 293001a

Please sign in to comment.