From a0da2d5e7ccbff1d53bc36a7417aa8035c0e150d Mon Sep 17 00:00:00 2001 From: thedevbirb Date: Fri, 11 Oct 2024 13:12:24 +0200 Subject: [PATCH] feat: add keystore folder to sidecar --- main.star | 2 ++ src/mev/bolt_sidecar/bolt_sidecar_launcher.star | 16 ++++++++++++++-- .../validator_keystore_generator.star | 7 +++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/main.star b/main.star index e276303a1..f9f8d1ba1 100644 --- a/main.star +++ b/main.star @@ -287,6 +287,8 @@ def run(plan, args={}): ), "jwt_hex": raw_jwt_secret, "metrics_port": bolt_sidecar.BOLT_SIDECAR_METRICS_PORT, + "validator_keystore_files_artifact_uuid": participant.cl_context.validator_keystore_files_artifact_uuid, + "participant_index": index, } if mev_params.bolt_boost_image == None: diff --git a/src/mev/bolt_sidecar/bolt_sidecar_launcher.star b/src/mev/bolt_sidecar/bolt_sidecar_launcher.star index 94086c4c2..73c05cf1d 100644 --- a/src/mev/bolt_sidecar/bolt_sidecar_launcher.star +++ b/src/mev/bolt_sidecar/bolt_sidecar_launcher.star @@ -2,9 +2,11 @@ redis_module = import_module("github.com/kurtosis-tech/redis-package/main.star") postgres_module = import_module("github.com/kurtosis-tech/postgres-package/main.star") constants = import_module("../../package_io/constants.star") input_parser = import_module("../../package_io/input_parser.star") +validator_keystore_generator = import_module("../../prelaunch_data_generator/validator_keystores/validator_keystore_generator.star") BOLT_SIDECAR_COMMITMENTS_API_PORT = 9061 BOLT_SIDECAR_METRICS_PORT = 9063 +BOLT_SIDECAR_KEYS_DIRMOUNT_PATH_ON_SERVICE = "/keys" # The min/max CPU/memory that bolt-sidecar can use BOLT_SIDECAR_MIN_CPU = 100 @@ -23,6 +25,9 @@ def launch_bolt_sidecar( "RUST_LOG": "bolt_sidecar=trace", } + node_keystore_path = validator_keystore_generator.NODE_KEYSTORES_OUTPUT_DIRPATH_FORMAT_STR.format(sidecar_config["participant_index"]) + full_keystore_path = "{0}{1}/keys".format(BOLT_SIDECAR_KEYS_DIRMOUNT_PATH_ON_SERVICE, node_keystore_path) + api = plan.add_service( name=sidecar_config["service_name"], config=ServiceConfig( @@ -30,9 +35,13 @@ def launch_bolt_sidecar( cmd=[ "--port", str(BOLT_SIDECAR_COMMITMENTS_API_PORT), - "--private-key", + # "--private-key", # Random private key for testing, generated with `openssl rand -hex 32` - "18d1c5302e734fd6fbfaa51828d42c4c6d3cbe020c42bab7dd15a2799cf00b82", + # "18d1c5302e734fd6fbfaa51828d42c4c6d3cbe020c42bab7dd15a2799cf00b82", + "--keystore-password", + validator_keystore_generator.PRYSM_PASSWORD, + "--keystore-path", + full_keystore_path, "--constraints-url", sidecar_config["constraints_api_url"], "--constraints-proxy-port", @@ -70,6 +79,9 @@ def launch_bolt_sidecar( number=BOLT_SIDECAR_METRICS_PORT, transport_protocol="TCP" ), }, + files={ + BOLT_SIDECAR_KEYS_DIRMOUNT_PATH_ON_SERVICE: sidecar_config["validator_keystore_files_artifact_uuid"], + }, env_vars=env_vars, min_cpu=BOLT_SIDECAR_MIN_CPU, max_cpu=BOLT_SIDECAR_MAX_CPU, diff --git a/src/prelaunch_data_generator/validator_keystores/validator_keystore_generator.star b/src/prelaunch_data_generator/validator_keystores/validator_keystore_generator.star index 3f2a22ec9..8b411d2c1 100644 --- a/src/prelaunch_data_generator/validator_keystores/validator_keystore_generator.star +++ b/src/prelaunch_data_generator/validator_keystores/validator_keystore_generator.star @@ -10,7 +10,8 @@ PRYSM_PASSWORD_FILEPATH_ON_GENERATOR = "/tmp/prysm-password.txt" KEYSTORES_GENERATION_TOOL_NAME = "/app/eth2-val-tools" -ETH_VAL_TOOLS_IMAGE = "protolambda/eth2-val-tools:latest" +# ETH_VAL_TOOLS_IMAGE = "protolambda/eth2-val-tools:latest" +ETH_VAL_TOOLS_IMAGE = "ghcr.io/chainbound/eth2-val-tools:0.1.0" SUCCESSFUL_EXEC_CMD_EXIT_CODE = 0 @@ -94,6 +95,7 @@ def generate_validator_keystores(plan, mnemonic, participants): running_total_validator_count += participant.validator_count stop_index = start_index + participant.validator_count + # NOTE: removed --insecure flag. generate_keystores_cmd = '{0} keystores --insecure --prysm-pass {1} --out-loc {2} --source-mnemonic "{3}" --source-min {4} --source-max {5}'.format( KEYSTORES_GENERATION_TOOL_NAME, PRYSM_PASSWORD, @@ -217,7 +219,8 @@ def generate_valdiator_keystores_in_parallel(plan, mnemonic, participants): ) finished_files_to_verify.append(generation_finished_filepath) - generate_keystores_cmd = 'nohup {0} keystores --insecure --prysm-pass {1} --out-loc {2} --source-mnemonic "{3}" --source-min {4} --source-max {5} && touch {6}'.format( + # NOTE: removed --insecure flag + generate_keystores_cmd = 'nohup {0} keystores --prysm-pass {1} --out-loc {2} --source-mnemonic "{3}" --source-min {4} --source-max {5} && touch {6}'.format( KEYSTORES_GENERATION_TOOL_NAME, PRYSM_PASSWORD, output_dirpath,