Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(helix): allow to extend config from kurtosis config file #25

Merged
merged 4 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ def run(plan, args={}):
all_participants=all_participants,
final_genesis_timestamp=final_genesis_timestamp,
genesis_validators_root=genesis_validators_root,
mev_params=mev_params,
)

return output
22 changes: 16 additions & 6 deletions src/mev/mev_relay/helix_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def launch_helix_relay(
network_config_dir_path_on_service,
validator_root,
genesis_timestamp,
mev_params.helix_relay_config_extension,
)

helix_config_template_and_data = shared_utils.new_template_and_data(
Expand Down Expand Up @@ -162,6 +163,8 @@ def launch_helix_relay(
),
)

plan.print(json.indent(json.encode(helix_config_template_data)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this useful?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it shows a nice print with the config which Helix is trying to run. Other services do that as well and I think it's useful.


return "http://{0}@{1}:{2}".format(
DUMMY_PUB_KEY, helix.ip_address, HELIX_RELAY_ENDPOINT_PORT
)
Expand All @@ -178,27 +181,34 @@ def new_config_template_data(
network_config_dir_path,
genesis_validator_root,
genesis_time,
config_extension,
):
return {
"PostgresConfig": {
config_hashmap = {
"postgres": {
"hostname": postgres_hostname,
"port": postgres_port,
"db_name": postgres_db_name,
"user": postgres_user,
"password": postgres_password,
},
"RedisConfig": {
"redis": {
"url": redis_url,
},
"BlockSimulatorConfig": {
"simulator": {
"url": blocksim_url,
},
"BeaconClientsConfig": [
"beacon_clients": [
{"url": uri} for uri in beacon_uris
],
"NetworkConfig": {
"network_config": {
"dir_path": network_config_dir_path,
"genesis_validator_root": genesis_validator_root,
"genesis_time": genesis_time,
},
}

if config_extension != None:
for key, value in config_extension.items():
config_hashmap[key] = value
thedevbirb marked this conversation as resolved.
Show resolved Hide resolved

return config_hashmap
8 changes: 5 additions & 3 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ def input_parser(plan, input_args):
result = enrich_disable_peer_scoring(result)

if result.get("mev_type") in ("mock", "full"):
if result.get("mev_params")["bolt_boost_image"] != None:
if result.get("mev_params")["bolt_sidecar_image"] == None:
result = enrich_mev_extra_params(
result,
BOLT_BOOST_SERVICE_NAME_PREFIX,
MEV_BOOST_SERVICE_NAME_PREFIX,
FLASHBOTS_MEV_BOOST_PORT,
result.get("mev_type"),
)
Expand Down Expand Up @@ -262,6 +262,7 @@ def input_parser(plan, input_args):
mev_relay_website_extra_args=result["mev_params"][
"mev_relay_website_extra_args"
],
helix_relay_config_extension=result["mev_params"]["helix_relay_config_extension"],
mev_builder_extra_args=result["mev_params"]["mev_builder_extra_args"],
mev_flood_image=result["mev_params"]["mev_flood_image"],
mev_flood_extra_args=result["mev_params"]["mev_flood_extra_args"],
Expand Down Expand Up @@ -731,7 +732,8 @@ def get_default_mev_params():
"mev_relay_api_extra_args": [],
"mev_relay_housekeeper_extra_args": [],
"mev_relay_website_extra_args": [],
"mev_builder_extra_args": [],
"helix_relay_config_extension": None,
"mev_builder_extra_args": None,
"mev_flood_image": "flashbots/mev-flood",
"mev_flood_extra_args": [],
"mev_flood_seconds_per_bundle": 15,
Expand Down
27 changes: 16 additions & 11 deletions static_files/helix-relay-config/config.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
postgres:
hostname: {{ .PostgresConfig.hostname }}
port: {{ .PostgresConfig.port }}
db_name: {{ .PostgresConfig.db_name }}
user: {{ .PostgresConfig.user }}
password: {{ .PostgresConfig.password }}
hostname: {{ .postgres.hostname }}
port: {{ .postgres.port }}
db_name: {{ .postgres.db_name }}
user: {{ .postgres.user }}
password: {{ .postgres.password }}
region: 0
region_name: "bolt"

redis:
url: {{ .RedisConfig.url }}
url: {{ .redis.url }}

simulator:
url: {{ .BlockSimulatorConfig.url }}
url: {{ .simulator.url }}

beacon_clients:
{{ range $bcConfig := .BeaconClientsConfig }}
{{ range $bcConfig := .beacon_clients }}
- url: "{{ $bcConfig.url }}"
{{- end }}

Expand All @@ -26,12 +26,17 @@ builders:
is_optimistic: false
builder_id: "Bolt Builder"

{{- if .constraints_api_config }}
constraints_api_config:
check_constraints_signature: {{ .constraints_api_config.check_constraints_signature }}
max_block_value_to_verify_wei: {{ .constraints_api_config.max_block_value_to_verify_wei }}
{{- end }}

network_config:
!Custom # this is a custom enum type and requies a '!'
dir_path: {{ .NetworkConfig.dir_path }}
genesis_validator_root: {{ .NetworkConfig.genesis_validator_root }}
genesis_time: {{ .NetworkConfig.genesis_time }}
dir_path: {{ .network_config.dir_path }}
genesis_validator_root: {{ .network_config.genesis_validator_root }}
genesis_time: {{ .network_config.genesis_time }}

# If empty, all routes are enabled
router_config:
Expand Down
Loading