Skip to content

Commit

Permalink
refactor: added custom port wait config for lighthouse validator (eth…
Browse files Browse the repository at this point in the history
  • Loading branch information
leoporoli authored Apr 26, 2023
1 parent d7d9a7e commit eef07c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ VALIDATOR_HTTP_PORT_ID = "http"
VALIDATOR_METRICS_PORT_ID = "metrics"
VALIDATOR_HTTP_PORT_NUM = 5042
VALIDATOR_METRICS_PORT_NUM = 5064
VALIDATOR_HTTP_PORT_WAIT_TIMEOUT = "6m"

METRICS_PATH = "/metrics"

Expand All @@ -53,7 +54,7 @@ BEACON_USED_PORTS = {
}

VALIDATOR_USED_PORTS = {
VALIDATOR_HTTP_PORT_ID: shared_utils.new_port_spec(VALIDATOR_HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL),
VALIDATOR_HTTP_PORT_ID: shared_utils.new_port_spec(VALIDATOR_HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.NOT_PROVIDED_APPLICATION_PROTOCOL, VALIDATOR_HTTP_PORT_WAIT_TIMEOUT),
VALIDATOR_METRICS_PORT_ID: shared_utils.new_port_spec(VALIDATOR_METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL),
}

Expand Down
8 changes: 6 additions & 2 deletions src/shared_utils/shared_utils.star
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ TCP_PROTOCOL = "TCP"
UDP_PROTOCOL = "UDP"
HTTP_APPLICATION_PROTOCOL = "http"
NOT_PROVIDED_APPLICATION_PROTOCOL = ""
NOT_PROVIDED_WAIT = "not-provided-wait"
def new_template_and_data(template, template_data_json):
return struct(template = template, data = template_data_json)

Expand All @@ -24,5 +25,8 @@ def path_dir(path):
return "/".join(split_path) or "/"


def new_port_spec(number, transport_protocol, application_protocol= NOT_PROVIDED_APPLICATION_PROTOCOL):
return PortSpec(number = number, transport_protocol = transport_protocol, application_protocol=application_protocol)
def new_port_spec(number, transport_protocol, application_protocol = NOT_PROVIDED_APPLICATION_PROTOCOL, wait = NOT_PROVIDED_WAIT):
if (wait == NOT_PROVIDED_WAIT):
return PortSpec(number = number, transport_protocol = transport_protocol, application_protocol = application_protocol)

return PortSpec(number = number, transport_protocol = transport_protocol, application_protocol = application_protocol, wait = wait)

0 comments on commit eef07c1

Please sign in to comment.