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 keystore folder to bolt sidecar #17

Merged
merged 1 commit into from
Oct 14, 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
2 changes: 2 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 14 additions & 2 deletions src/mev/bolt_sidecar/bolt_sidecar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,16 +25,23 @@ 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(
image=image,
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",
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading