From 2612d801c09fecd27bddb1be0109e95b8d09c1b2 Mon Sep 17 00:00:00 2001 From: TobiWo Date: Thu, 24 Oct 2024 08:36:08 +0200 Subject: [PATCH 1/3] feat: Add vouch images and vc type --- src/package_io/constants.star | 1 + src/package_io/input_parser.star | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/package_io/constants.star b/src/package_io/constants.star index 664e476bf..49750b768 100644 --- a/src/package_io/constants.star +++ b/src/package_io/constants.star @@ -24,6 +24,7 @@ VC_TYPE = struct( nimbus="nimbus", prysm="prysm", teku="teku", + vouch="vouch" ) REMOTE_SIGNER_TYPE = struct(web3signer="web3signer") diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 44c608c96..2c937379b 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -41,6 +41,7 @@ DEFAULT_VC_IMAGES = { "prysm": "gcr.io/prysmaticlabs/prysm/validator:stable", "teku": "consensys/teku:latest", "grandine": "sifrai/grandine:stable", + "vouch": "attestant/vouch:latest", } DEFAULT_VC_IMAGES_MINIMAL = { @@ -50,6 +51,7 @@ DEFAULT_VC_IMAGES_MINIMAL = { "prysm": "ethpandaops/prysm-validator:develop-minimal", "teku": "consensys/teku:latest", "grandine": "ethpandaops/grandine:master-minimal", + "vouch": "attestant/vouch:latest", } DEFAULT_REMOTE_SIGNER_IMAGES = { From 94e0f3151375f7a69bca1b60fa7d4f3285f27d67 Mon Sep 17 00:00:00 2001 From: TobiWo Date: Thu, 24 Oct 2024 08:45:34 +0200 Subject: [PATCH 2/3] docs: WIP: Add vouch as vc type --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a789a264c..a6afe95ca 100644 --- a/README.md +++ b/README.md @@ -296,7 +296,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 vouch # ( The prysm validator only works with a prysm CL client ) # Defaults to matching the chosen CL client (cl_type) vc_type: "" @@ -308,6 +308,7 @@ participants: # - nimbus: statusim/nimbus-validator-client:multiarch-latest # - prysm: gcr.io/prysmaticlabs/prysm/validator:latest # - teku: consensys/teku:latest + # - vouch: attestant/vouch:latest vc_image: "" # The number of validator clients to run for this participant From 9e7bb7520733d02a5b898738b227305ce12100bf Mon Sep 17 00:00:00 2001 From: TobiWo Date: Thu, 24 Oct 2024 08:36:56 +0200 Subject: [PATCH 3/3] feat: WIP: Add vouch configuration --- src/vc/vc_launcher.star | 19 ++++++ src/vc/vouch.star | 133 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 src/vc/vouch.star diff --git a/src/vc/vc_launcher.star b/src/vc/vc_launcher.star index 9ae37dae9..df3a91022 100644 --- a/src/vc/vc_launcher.star +++ b/src/vc/vc_launcher.star @@ -8,6 +8,7 @@ lodestar = import_module("./lodestar.star") nimbus = import_module("./nimbus.star") prysm = import_module("./prysm.star") teku = import_module("./teku.star") +vouch = import_module("./vouch.star") vc_shared = import_module("./shared.star") shared_utils = import_module("../shared_utils/shared_utils.star") @@ -151,6 +152,24 @@ def launch( port_publisher=port_publisher, vc_index=vc_index, ) + elif vc_type == constants.VC_TYPE.vouch: + config = vouch.get_config( + participant=participant, + el_cl_genesis_data=launcher.el_cl_genesis_data, + image=image, + keymanager_file=keymanager_file, + beacon_http_url=beacon_http_url, + cl_context=cl_context, + el_context=el_context, + remote_signer_context=remote_signer_context, + full_name=full_name, + node_keystore_files=node_keystore_files, + tolerations=tolerations, + node_selectors=node_selectors, + keymanager_enabled=keymanager_enabled, + port_publisher=port_publisher, + vc_index=vc_index, + ) elif vc_type == constants.VC_TYPE.grandine: fail("Grandine VC is not yet supported") else: diff --git a/src/vc/vouch.star b/src/vc/vouch.star new file mode 100644 index 000000000..8aa819be2 --- /dev/null +++ b/src/vc/vouch.star @@ -0,0 +1,133 @@ +constants = import_module("../package_io/constants.star") +shared_utils = import_module("../shared_utils/shared_utils.star") +vc_shared = import_module("./shared.star") + + +def get_config( + participant, + el_cl_genesis_data, + image, + keymanager_file, + beacon_http_url, + cl_context, + el_context, + remote_signer_context, + full_name, + node_keystore_files, + tolerations, + node_selectors, + keymanager_enabled, + port_publisher, + vc_index, +): + validator_keys_dirpath = "" + validator_secrets_dirpath = "" + if node_keystore_files != None: + validator_keys_dirpath = shared_utils.path_join( + constants.VALIDATOR_KEYS_DIRPATH_ON_SERVICE_CONTAINER, + node_keystore_files.nimbus_keys_relative_dirpath, + ) + validator_secrets_dirpath = shared_utils.path_join( + constants.VALIDATOR_KEYS_DIRPATH_ON_SERVICE_CONTAINER, + node_keystore_files.raw_secrets_relative_dirpath, + ) + + # general startup flags + # change them to vouch specific flags but keep constants + cmd = [ + "--beacon-node=" + beacon_http_url, + "--suggested-fee-recipient=" + constants.VALIDATING_REWARDS_ACCOUNT, + # vvvvvvvvvvvvvvvvvvv METRICS CONFIG vvvvvvvvvvvvvvvvvvvvv + "--metrics", + "--metrics-address=0.0.0.0", + "--metrics-port={0}".format(vc_shared.VALIDATOR_CLIENT_METRICS_PORT_NUM), + "--graffiti=" + full_name, + ] + + if remote_signer_context == None: + cmd.extend( + [ + "--validators-dir=" + validator_keys_dirpath, + "--secrets-dir=" + validator_secrets_dirpath, + ] + ) + else: + cmd.extend( + [ + "--web3-signer-url={0}".format(remote_signer_context.http_url), + ] + ) + + # is keymanager supported by vouch? + # if yes, adapt accordingly + # keep constants + keymanager_api_cmd = [ + "--keymanager", + "--keymanager-port={0}".format(vc_shared.VALIDATOR_HTTP_PORT_NUM), + "--keymanager-address=0.0.0.0", + "--keymanager-allow-origin=*", + "--keymanager-token-file=" + constants.KEYMANAGER_MOUNT_PATH_ON_CONTAINER, + ] + + if len(participant.vc_extra_params) > 0: + # this is a repeated, we convert it into Starlark + cmd.extend([param for param in participant.vc_extra_params]) + + files = { + constants.VALIDATOR_KEYS_DIRPATH_ON_SERVICE_CONTAINER: node_keystore_files.files_artifact_uuid, + constants.KEYMANAGER_MOUNT_PATH_ON_CLIENTS: keymanager_file, + } + + public_ports = {} + public_keymanager_port_assignment = {} + 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_keymanager_port_assignment = { + constants.VALIDATOR_HTTP_PORT_ID: public_ports_for_component[1] + } + public_ports = shared_utils.get_port_specs(public_port_assignments) + + ports = {} + ports.update(vc_shared.VALIDATOR_CLIENT_USED_PORTS) + + if keymanager_enabled: + cmd.extend(keymanager_api_cmd) + ports.update(vc_shared.VALIDATOR_KEYMANAGER_USED_PORTS) + public_ports.update( + shared_utils.get_port_specs(public_keymanager_port_assignment) + ) + + config_args = { + "image": image, + "ports": ports, + "public_ports": public_ports, + "cmd": cmd, + "files": files, + "env_vars": participant.vc_extra_env_vars, + "labels": shared_utils.label_maker( + client=constants.VC_TYPE.vouch, + 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, + "user": User(uid=0, gid=0), + } + + 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)