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: add vero vc_type #827

Merged
merged 3 commits into from
Nov 20, 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
31 changes: 31 additions & 0 deletions .github/tests/vero-all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
participants:
- el_type: besu
cl_type: grandine
use_separate_vc: true
vc_type: vero
use_remote_signer: true
- el_type: erigon
cl_type: lighthouse
use_separate_vc: true
vc_type: vero
use_remote_signer: true
- el_type: ethereumjs
cl_type: lodestar
use_separate_vc: true
vc_type: vero
use_remote_signer: true
- el_type: geth
cl_type: nimbus
use_separate_vc: true
vc_type: vero
use_remote_signer: true
- el_type: nethermind
cl_type: prysm
use_separate_vc: true
vc_type: vero
use_remote_signer: true
- el_type: reth
cl_type: teku
use_separate_vc: true
vc_type: vero
use_remote_signer: true
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ participants:

# VC (Validator Client) Specific flags
# The type of validator client that should be used
# Valid values are nimbus, lighthouse, lodestar, teku, and prysm
# Valid values are nimbus, lighthouse, lodestar, teku, prysm and vero
# ( The prysm validator only works with a prysm CL client )
# Defaults to matching the chosen CL client (cl_type)
vc_type: ""
Expand All @@ -301,6 +301,7 @@ participants:
# - nimbus: statusim/nimbus-validator-client:multiarch-latest
# - prysm: gcr.io/prysmaticlabs/prysm/validator:latest
# - teku: consensys/teku:latest
# - vero: ghcr.io/serenita-org/vero:master
vc_image: ""

# The number of validator clients to run for this participant
Expand Down
1 change: 1 addition & 0 deletions src/package_io/constants.star
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ VC_TYPE = struct(
nimbus="nimbus",
prysm="prysm",
teku="teku",
vero="vero",
)

REMOTE_SIGNER_TYPE = struct(web3signer="web3signer")
Expand Down
5 changes: 5 additions & 0 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ DEFAULT_VC_IMAGES = {
"prysm": "gcr.io/prysmaticlabs/prysm/validator:stable",
"teku": "consensys/teku:latest",
"grandine": "sifrai/grandine:stable",
"vero": "ghcr.io/serenita-org/vero:master",
}

DEFAULT_VC_IMAGES_MINIMAL = {
Expand All @@ -50,6 +51,7 @@ DEFAULT_VC_IMAGES_MINIMAL = {
"prysm": "ethpandaops/prysm-validator:develop-minimal",
"teku": "consensys/teku:latest",
"grandine": "ethpandaops/grandine:develop-minimal",
"vero": "ghcr.io/serenita-org/vero:master",
}

DEFAULT_REMOTE_SIGNER_IMAGES = {
Expand Down Expand Up @@ -1201,6 +1203,9 @@ def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port, mev_typ
if participant["cl_type"] == "grandine":
participant["cl_extra_params"].append("--builder-url={0}".format(mev_url))

if participant["vc_type"] == "vero":
participant["vc_extra_params"].append("--use-external-builder")

num_participants = len(parsed_arguments_dict["participants"])
index_str = shared_utils.zfill_custom(
num_participants + 1, len(str(num_participants + 1))
Expand Down
2 changes: 1 addition & 1 deletion src/vc/lighthouse.star
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def get_config(
"files": files,
"env_vars": env,
"labels": shared_utils.label_maker(
client=constants.CL_TYPE.lighthouse,
client=constants.VC_TYPE.lighthouse,
client_type=constants.CLIENT_TYPES.validator,
image=image,
connected_client=cl_context.client_name,
Expand Down
2 changes: 1 addition & 1 deletion src/vc/lodestar.star
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def get_config(
"files": files,
"env_vars": env_vars,
"labels": shared_utils.label_maker(
client=constants.CL_TYPE.lodestar,
client=constants.VC_TYPE.lodestar,
client_type=constants.CLIENT_TYPES.validator,
image=image,
connected_client=cl_context.client_name,
Expand Down
2 changes: 1 addition & 1 deletion src/vc/nimbus.star
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def get_config(
"files": files,
"env_vars": participant.vc_extra_env_vars,
"labels": shared_utils.label_maker(
client=constants.CL_TYPE.nimbus,
client=constants.VC_TYPE.nimbus,
client_type=constants.CLIENT_TYPES.validator,
image=image,
connected_client=cl_context.client_name,
Expand Down
2 changes: 1 addition & 1 deletion src/vc/prysm.star
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_config(
"files": files,
"env_vars": participant.vc_extra_env_vars,
"labels": shared_utils.label_maker(
client=constants.CL_TYPE.prysm,
client=constants.VC_TYPE.prysm,
client_type=constants.CLIENT_TYPES.validator,
image=image,
connected_client=cl_context.client_name,
Expand Down
2 changes: 1 addition & 1 deletion src/vc/teku.star
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def get_config(
"files": files,
"env_vars": participant.vc_extra_env_vars,
"labels": shared_utils.label_maker(
client=constants.CL_TYPE.teku,
client=constants.VC_TYPE.teku,
client_type=constants.CLIENT_TYPES.validator,
image=image,
connected_client=cl_context.client_name,
Expand Down
19 changes: 19 additions & 0 deletions src/vc/vc_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ lodestar = import_module("./lodestar.star")
nimbus = import_module("./nimbus.star")
prysm = import_module("./prysm.star")
teku = import_module("./teku.star")
vero = import_module("./vero.star")
vc_shared = import_module("./shared.star")
shared_utils = import_module("../shared_utils/shared_utils.star")

Expand Down Expand Up @@ -151,6 +152,24 @@ def launch(
port_publisher=port_publisher,
vc_index=vc_index,
)
elif vc_type == constants.VC_TYPE.vero:
if remote_signer_context == None:
fail("vero VC requires `use_remote_signer` to be true")
if keymanager_enabled:
fail("vero VC doesn't support the Keymanager API")
config = vero.get_config(
participant=participant,
image=image,
global_log_level=global_log_level,
beacon_http_url=beacon_http_url,
cl_context=cl_context,
remote_signer_context=remote_signer_context,
full_name=full_name,
tolerations=tolerations,
node_selectors=node_selectors,
port_publisher=port_publisher,
vc_index=vc_index,
)
elif vc_type == constants.VC_TYPE.grandine:
fail("Grandine VC is not yet supported")
else:
Expand Down
85 changes: 85 additions & 0 deletions src/vc/vero.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
constants = import_module("../package_io/constants.star")
input_parser = import_module("../package_io/input_parser.star")
shared_utils = import_module("../shared_utils/shared_utils.star")
vc_shared = import_module("./shared.star")


VERBOSITY_LEVELS = {
constants.GLOBAL_LOG_LEVEL.error: "ERROR",
constants.GLOBAL_LOG_LEVEL.warn: "WARNING",
constants.GLOBAL_LOG_LEVEL.info: "INFO",
constants.GLOBAL_LOG_LEVEL.debug: "DEBUG",
}


def get_config(
participant,
image,
global_log_level,
beacon_http_url,
cl_context,
remote_signer_context,
full_name,
tolerations,
node_selectors,
port_publisher,
vc_index,
):
log_level = input_parser.get_client_log_level_or_default(
participant.vc_log_level, global_log_level, VERBOSITY_LEVELS
)

cmd = [
"--remote-signer-url={0}".format(remote_signer_context.http_url),
"--beacon-node-urls=" + beacon_http_url,
"--fee-recipient=" + constants.VALIDATING_REWARDS_ACCOUNT,
"--graffiti=" + full_name,
"--metrics-address=0.0.0.0",
"--metrics-port={0}".format(vc_shared.VALIDATOR_CLIENT_METRICS_PORT_NUM),
"--log-level=" + log_level,
]

if len(participant.vc_extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in participant.vc_extra_params])

public_ports = {}
if port_publisher.vc_enabled:
public_ports_for_component = shared_utils.get_public_ports_for_component(
"vc", port_publisher, vc_index
)
public_port_assignments = {
constants.METRICS_PORT_ID: public_ports_for_component[0]
}
public_ports = shared_utils.get_port_specs(public_port_assignments)

ports = {}
ports.update(vc_shared.VALIDATOR_CLIENT_USED_PORTS)

config_args = {
"image": image,
"ports": ports,
"public_ports": public_ports,
"cmd": cmd,
"env_vars": participant.vc_extra_env_vars,
"labels": shared_utils.label_maker(
client=constants.VC_TYPE.vero,
client_type=constants.CLIENT_TYPES.validator,
image=image,
connected_client=cl_context.client_name,
extra_labels=participant.vc_extra_labels,
supernode=participant.supernode,
),
"tolerations": tolerations,
"node_selectors": node_selectors,
}

if participant.vc_min_cpu > 0:
config_args["min_cpu"] = participant.vc_min_cpu
if participant.vc_max_cpu > 0:
config_args["max_cpu"] = participant.vc_max_cpu
if participant.vc_min_mem > 0:
config_args["min_memory"] = participant.vc_min_mem
if participant.vc_max_mem > 0:
config_args["max_memory"] = participant.vc_max_mem
return ServiceConfig(**config_args)
Loading