Commit 8513c060 authored by Barnabas Busa's avatar Barnabas Busa Committed by GitHub

feat: enable one parameter supernode, refactor el,cl,vc (#778)

parent cb87a9a8
participants:
# Super nodes
- cl_type: prysm
cl_image: ethpandaops/prysm-beacon-chain:peerDAS
supernode: true
cl_extra_params:
- --minimum-peers-per-subnet=1
count: 3
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
- cl_type: lighthouse
cl_image: ethpandaops/lighthouse:unstable
supernode: true
count: 3
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
- cl_type: teku
cl_image: ethpandaops/teku:nashatyrev-das
supernode: true
count: 3
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
- cl_type: nimbus
cl_image: ethpandaops/nimbus-eth2:pdsync
supernode: true
cl_extra_params:
- --sync-light-client=no
count: 3
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
- cl_type: lodestar
cl_image: ethpandaops/lodestar:peerDAS
supernode: true
cl_extra_params:
- --persistNetworkIdentity
count: 3
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
- cl_type: grandine
cl_image: ethpandaops/grandine:hangleang-fix-negotiation-timeout
supernode: true
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
# Full nodes
- cl_type: prysm
cl_image: ethpandaops/prysm-beacon-chain:peerDAS
cl_extra_params:
- --minimum-peers-per-subnet=1
- --data-columns-withhold-count=64
count: 3
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
- cl_type: lighthouse
cl_image: ethpandaops/lighthouse:unstable
count: 3
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
- cl_type: lodestar
cl_image: ethpandaops/lodestar:peerDAS
cl_extra_params: [--persistNetworkIdentity]
count: 3
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
- cl_type: nimbus
cl_image: ethpandaops/nimbus-eth2:pdsync
cl_extra_params:
- --sync-light-client=no
count: 3
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
- cl_type: teku
cl_image: ethpandaops/teku:nashatyrev-das
count: 3
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
- cl_type: grandine
cl_image: ethpandaops/grandine:hangleang-fix-negotiation-timeout
cl_min_cpu: 1000
cl_min_mem: 1024
cl_max_cpu: 4000
cl_max_mem: 8096
el_min_cpu: 1000
el_min_mem: 1024
el_max_cpu: 4000
el_max_mem: 8096
network_params:
eip7594_fork_epoch: 0
eip7594_fork_version: "0x50000038"
genesis_delay: 1200
snooper_enabled: true
global_log_level: debug
additional_services:
- dora
- goomy_blob
- prometheus_grafana
dora_params:
image: ethpandaops/dora:peerdas-as-deneb-column-view-latest
env: {"FRONTEND_SHOW_PEER_DAS_INFOS": "true", "FRONTEND_SHOW_SENSITIVE_PEER_INFOS": "true"}
ethereum_metrics_exporter_enabled: true
participants:
# Supernodes
- cl_type: prysm
cl_image: ethpandaops/prysm-beacon-chain:peerDAS
cl_extra_params: [--subscribe-all-subnets, --pprof]
cl_max_mem: 4096
count: 2
# - cl_type: lighthouse
# cl_image: ethpandaops/lighthouse:unstable
# cl_extra_params: [--subscribe-all-data-column-subnets]
#- cl_type: teku
# cl_image: ethpandaops/teku:nashatyrev-das
# cl_extra_params: [--p2p-subscribe-all-custody-subnets-enabled]
# - cl_type: nimbus
# cl_image: ethpandaops/nimbus-eth2:pdsync-minimal
# cl_extra_params: [--subscribe-all-subnets=true, --sync-light-client=no ]
# count: 2
# - cl_type: lodestar
# cl_image: ethpandaops/lodestar:peerDAS
# cl_extra_params: [--persistNetworkIdentity, --supernode]
# # Non supernodes
- cl_type: prysm
cl_image: ethpandaops/prysm-beacon-chain:peerDAS
cl_max_mem: 4096
# - cl_type: lighthouse
# cl_image: ethpandaops/lighthouse:unstable
#- cl_type: teku
# cl_image: ethpandaops/teku:nashatyrev-das
# - cl_type: nimbus
# cl_image: ethpandaops/nimbus-eth2:pdsync-minimal
# cl_extra_params: [--sync-light-client=no]
# - cl_type: lodestar
# cl_image: ethpandaops/lodestar:peerDAS
# cl_extra_params: [--persistNetworkIdentity]
network_params:
eip7594_fork_epoch: 0
eip7594_fork_version: "0x50000038"
#preset: minimal
snooper_enabled: true
global_log_level: debug
additional_services:
- dora
- goomy_blob
- prometheus_grafana
- assertoor
dora_params:
image: ethpandaops/dora:peerdas-as-deneb
ethereum_metrics_exporter_enabled: true
assertoor_params:
run_stability_check: false
run_block_proposal_check: false
tests:
- { file: "https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/block-proposal-check.yaml" }
- { file: "https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/blob-transactions-test.yaml" }
- { file: "https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/stability-check.yaml" }
participants:
# Supernodes
- cl_type: prysm
cl_image: ethpandaops/prysm-beacon-chain:peerDAS-df42f37
supernode: true
- cl_type: lighthouse
cl_image: ethpandaops/lighthouse:unstable-2792705
supernode: true
- cl_type: teku
cl_image: ethpandaops/teku:nashatyrev-das-458f7e7
supernode: true
- cl_type: nimbus
cl_image: ethpandaops/nimbus-eth2:pdsync-30f8ef9
supernode: true
- cl_type: lodestar
cl_image: ethpandaops/lodestar:peerDAS-a3de70f
supernode: true
- cl_type: grandine
cl_image: ethpandaops/grandine:hangleang-feature-das-2c2f74b
supernode: true
# Fullnodes
- cl_type: prysm
cl_image: ethpandaops/prysm-beacon-chain:peerDAS-df42f37
- cl_type: lighthouse
cl_image: ethpandaops/lighthouse:unstable-2792705
- cl_type: teku
cl_image: ethpandaops/teku:nashatyrev-das-458f7e7
- cl_type: nimbus
cl_image: ethpandaops/nimbus-eth2:pdsync-30f8ef9
- cl_type: lodestar
cl_image: ethpandaops/lodestar:peerDAS-a3de70f
- cl_type: grandine
cl_image: ethpandaops/grandine:hangleang-feature-das-2c2f74b
network_params:
network: peerdas-devnet-2
snooper_enabled: true
additional_services:
- dora
participants:
- cl_type: prysm
cl_image: ethpandaops/prysm-beacon-chain:peerDAS
- cl_type: lighthouse
cl_image: ethpandaops/lighthouse:das
- cl_type: teku
cl_image: ethpandaops/teku:nashatyrev-das
network_params:
network: peerdas-devnet-2
snooper_enabled: true
...@@ -284,6 +284,12 @@ participants: ...@@ -284,6 +284,12 @@ participants:
cl_min_mem: 0 cl_min_mem: 0
cl_max_mem: 0 cl_max_mem: 0
# Whether to act as a supernode for the network
# Supernodes will subscribe to all subnet topics
# This flag should only be used with peerdas
# Defaults to false
supernode: false
# Whether to use a separate validator client attached to the CL client. # Whether to use a separate validator client attached to the CL client.
# Defaults to false for clients that can run both in one process (Teku, Nimbus) # Defaults to false for clients that can run both in one process (Teku, Nimbus)
use_separate_vc: true use_separate_vc: true
......
...@@ -25,6 +25,7 @@ participants: ...@@ -25,6 +25,7 @@ participants:
cl_max_cpu: 0 cl_max_cpu: 0
cl_min_mem: 0 cl_min_mem: 0
cl_max_mem: 0 cl_max_mem: 0
supernode: false
use_separate_vc: true use_separate_vc: true
# Validator # Validator
vc_type: lighthouse vc_type: lighthouse
......
...@@ -63,8 +63,6 @@ def launch( ...@@ -63,8 +63,6 @@ def launch(
el_cl_data, el_cl_data,
jwt_file, jwt_file,
network_params, network_params,
prysm_password_relative_filepath,
prysm_password_artifact_uuid,
), ),
"launch_method": prysm.launch, "launch_method": prysm.launch,
}, },
...@@ -108,22 +106,6 @@ def launch( ...@@ -108,22 +106,6 @@ def launch(
participant.cl_tolerations, participant.tolerations, global_tolerations participant.cl_tolerations, participant.tolerations, global_tolerations
) )
(
cl_min_cpu,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
cl_volume_size,
) = shared_utils.get_cpu_mem_resource_limits(
participant.cl_min_cpu,
participant.cl_max_cpu,
participant.cl_min_mem,
participant.cl_max_mem,
participant.cl_volume_size,
network_name,
participant.cl_type,
)
if cl_type not in cl_launchers: if cl_type not in cl_launchers:
fail( fail(
"Unsupported launcher '{0}', need one of '{1}'".format( "Unsupported launcher '{0}', need one of '{1}'".format(
...@@ -171,30 +153,16 @@ def launch( ...@@ -171,30 +153,16 @@ def launch(
plan, plan,
cl_launcher, cl_launcher,
cl_service_name, cl_service_name,
participant.cl_image, participant,
participant.cl_log_level,
global_log_level, global_log_level,
cl_context_BOOTNODE, cl_context_BOOTNODE,
el_context, el_context,
full_name, full_name,
new_cl_node_validator_keystores, new_cl_node_validator_keystores,
cl_min_cpu,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
participant.snooper_enabled,
snooper_engine_context, snooper_engine_context,
participant.blobber_enabled,
participant.blobber_extra_params,
participant.cl_extra_params,
participant.cl_extra_env_vars,
participant.cl_extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
participant.use_separate_vc,
participant.keymanager_enabled,
checkpoint_sync_enabled, checkpoint_sync_enabled,
checkpoint_sync_url, checkpoint_sync_url,
port_publisher, port_publisher,
...@@ -206,30 +174,16 @@ def launch( ...@@ -206,30 +174,16 @@ def launch(
plan, plan,
cl_launcher, cl_launcher,
cl_service_name, cl_service_name,
participant.cl_image, participant,
participant.cl_log_level,
global_log_level, global_log_level,
boot_cl_client_ctx, boot_cl_client_ctx,
el_context, el_context,
full_name, full_name,
new_cl_node_validator_keystores, new_cl_node_validator_keystores,
cl_min_cpu,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
participant.snooper_enabled,
snooper_engine_context, snooper_engine_context,
participant.blobber_enabled,
participant.blobber_extra_params,
participant.cl_extra_params,
participant.cl_extra_env_vars,
participant.cl_extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
participant.use_separate_vc,
participant.keymanager_enabled,
checkpoint_sync_enabled, checkpoint_sync_enabled,
checkpoint_sync_url, checkpoint_sync_url,
port_publisher, port_publisher,
......
This diff is collapsed.
...@@ -39,64 +39,38 @@ VERBOSITY_LEVELS = { ...@@ -39,64 +39,38 @@ VERBOSITY_LEVELS = {
def launch( def launch(
plan, plan,
launcher, launcher,
service_name, beacon_service_name,
image, participant,
participant_log_level,
global_log_level, global_log_level,
bootnode_contexts, bootnode_contexts,
el_context, el_context,
full_name, full_name,
node_keystore_files, node_keystore_files,
cl_min_cpu,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
blobber_enabled,
blobber_extra_params,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
use_separate_vc,
keymanager_enabled,
checkpoint_sync_enabled, checkpoint_sync_enabled,
checkpoint_sync_url, checkpoint_sync_url,
port_publisher, port_publisher,
participant_index, participant_index,
): ):
beacon_service_name = "{0}".format(service_name)
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.cl_log_level, global_log_level, VERBOSITY_LEVELS
) )
# Launch Beacon node # Launch Beacon node
beacon_config = get_beacon_config( beacon_config = get_beacon_config(
plan, plan,
launcher.el_cl_genesis_data, launcher,
launcher.jwt_file,
launcher.network,
image,
beacon_service_name, beacon_service_name,
participant,
log_level,
bootnode_contexts, bootnode_contexts,
el_context, el_context,
log_level, full_name,
cl_min_cpu, node_keystore_files,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
checkpoint_sync_enabled, checkpoint_sync_enabled,
...@@ -112,13 +86,13 @@ def launch( ...@@ -112,13 +86,13 @@ def launch(
) )
# Blobber config # Blobber config
if blobber_enabled: if participant.blobber_enabled:
blobber_service_name = "{0}-{1}".format("blobber", beacon_service_name) blobber_service_name = "{0}-{1}".format("blobber", beacon_service_name)
blobber_config = blobber_launcher.get_config( blobber_config = blobber_launcher.get_config(
blobber_service_name, blobber_service_name,
node_keystore_files, node_keystore_files,
beacon_http_url, beacon_http_url,
blobber_extra_params, participant.blobber_extra_params,
node_selectors, node_selectors,
) )
...@@ -166,7 +140,7 @@ def launch( ...@@ -166,7 +140,7 @@ def launch(
beacon_service_name=beacon_service_name, beacon_service_name=beacon_service_name,
multiaddr=beacon_multiaddr, multiaddr=beacon_multiaddr,
peer_id=beacon_peer_id, peer_id=beacon_peer_id,
snooper_enabled=snooper_enabled, snooper_enabled=participant.snooper_enabled,
snooper_engine_context=snooper_engine_context, snooper_engine_context=snooper_engine_context,
validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid
if node_keystore_files if node_keystore_files
...@@ -176,25 +150,16 @@ def launch( ...@@ -176,25 +150,16 @@ def launch(
def get_beacon_config( def get_beacon_config(
plan, plan,
el_cl_genesis_data, launcher,
jwt_file, beacon_service_name,
network, participant,
image,
service_name,
boot_cl_client_ctxs,
el_context,
log_level, log_level,
cl_min_cpu, bootnode_contexts,
cl_max_cpu, el_context,
cl_min_mem, full_name,
cl_max_mem, node_keystore_files,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
checkpoint_sync_enabled, checkpoint_sync_enabled,
...@@ -203,7 +168,7 @@ def get_beacon_config( ...@@ -203,7 +168,7 @@ def get_beacon_config(
participant_index, participant_index,
): ):
# If snooper is enabled use the snooper engine context, otherwise use the execution client context # If snooper is enabled use the snooper engine context, otherwise use the execution client context
if snooper_enabled: if participant.snooper_enabled:
EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format( EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format(
snooper_engine_context.ip_addr, snooper_engine_context.ip_addr,
snooper_engine_context.engine_rpc_port_num, snooper_engine_context.engine_rpc_port_num,
...@@ -278,82 +243,94 @@ def get_beacon_config( ...@@ -278,82 +243,94 @@ def get_beacon_config(
"--enable-private-discovery", "--enable-private-discovery",
] ]
supernode_cmd = [
"--subscribe-all-data-column-subnets",
]
if participant.supernode:
cmd.extend(supernode_cmd)
# If checkpoint sync is enabled, add the checkpoint sync url # If checkpoint sync is enabled, add the checkpoint sync url
if checkpoint_sync_enabled: if checkpoint_sync_enabled:
if checkpoint_sync_url: if checkpoint_sync_url:
cmd.append("--checkpoint-sync-url=" + checkpoint_sync_url) cmd.append("--checkpoint-sync-url=" + checkpoint_sync_url)
else: else:
if ( if (
network in constants.PUBLIC_NETWORKS launcher.network in constants.PUBLIC_NETWORKS
or network == constants.NETWORK_NAME.ephemery or launcher.network == constants.NETWORK_NAME.ephemery
): ):
cmd.append( cmd.append(
"--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network] "--checkpoint-sync-url="
+ constants.CHECKPOINT_SYNC_URL[launcher.network]
) )
else: else:
fail( fail(
"Checkpoint sync URL is required if you enabled checkpoint_sync for custom networks. Please provide a valid URL." "Checkpoint sync URL is required if you enabled checkpoint_sync for custom networks. Please provide a valid URL."
) )
if network not in constants.PUBLIC_NETWORKS: if launcher.network not in constants.PUBLIC_NETWORKS:
cmd.append("--testnet-dir=" + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER) cmd.append("--testnet-dir=" + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER)
if ( if (
network == constants.NETWORK_NAME.kurtosis launcher.network == constants.NETWORK_NAME.kurtosis
or constants.NETWORK_NAME.shadowfork in network or constants.NETWORK_NAME.shadowfork in launcher.network
): ):
if boot_cl_client_ctxs != None: if bootnode_contexts != None:
cmd.append( cmd.append(
"--boot-nodes=" "--boot-nodes="
+ ",".join( + ",".join(
[ [
ctx.enr ctx.enr
for ctx in boot_cl_client_ctxs[: constants.MAX_ENR_ENTRIES] for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]
] ]
) )
) )
elif network == constants.NETWORK_NAME.ephemery: elif launcher.network == constants.NETWORK_NAME.ephemery:
cmd.append( cmd.append(
"--boot-nodes=" "--boot-nodes="
+ shared_utils.get_devnet_enrs_list( + shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid plan, launcher.el_cl_genesis_data.files_artifact_uuid
) )
) )
else: # Devnets else: # Devnets
cmd.append( cmd.append(
"--boot-nodes=" "--boot-nodes="
+ shared_utils.get_devnet_enrs_list( + shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid plan, launcher.el_cl_genesis_data.files_artifact_uuid
) )
) )
else: # Public networks else: # Public networks
cmd.append("--network=" + network) cmd.append("--network=" + launcher.network)
if len(extra_params) > 0: if len(participant.cl_extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark # this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.cl_extra_params])
recipe = GetHttpRequestRecipe( recipe = GetHttpRequestRecipe(
endpoint="/eth/v1/node/identity", port_id=constants.HTTP_PORT_ID endpoint="/eth/v1/node/identity", port_id=constants.HTTP_PORT_ID
) )
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
} }
if persistent: if persistent:
files[BEACON_DATA_DIRPATH_ON_BEACON_SERVICE_CONTAINER] = Directory( files[BEACON_DATA_DIRPATH_ON_BEACON_SERVICE_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(beacon_service_name),
size=cl_volume_size, size=int(participant.cl_volume_size)
if int(participant.cl_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.CL_TYPE.lighthouse + "_volume_size"
],
) )
env = {RUST_BACKTRACE_ENVVAR_NAME: RUST_FULL_BACKTRACE_KEYWORD} env_vars = {RUST_BACKTRACE_ENVVAR_NAME: RUST_FULL_BACKTRACE_KEYWORD}
env.update(extra_env_vars) env_vars.update(participant.cl_extra_env_vars)
config_args = { config_args = {
"image": image, "image": participant.cl_image,
"ports": used_ports, "ports": used_ports,
"public_ports": public_ports, "public_ports": public_ports,
"cmd": cmd, "cmd": cmd,
"files": files, "files": files,
"env_vars": env, "env_vars": env_vars,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"ready_conditions": cl_node_ready_conditions.get_ready_conditions( "ready_conditions": cl_node_ready_conditions.get_ready_conditions(
constants.HTTP_PORT_ID constants.HTTP_PORT_ID
...@@ -361,26 +338,22 @@ def get_beacon_config( ...@@ -361,26 +338,22 @@ def get_beacon_config(
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.CL_TYPE.lighthouse, constants.CL_TYPE.lighthouse,
constants.CLIENT_TYPES.cl, constants.CLIENT_TYPES.cl,
image, participant.cl_image,
el_context.client_name, el_context.client_name,
extra_labels, participant.cl_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if cl_min_cpu > 0: if int(participant.cl_min_cpu) > 0:
config_args["min_cpu"] = cl_min_cpu config_args["min_cpu"] = int(participant.cl_min_cpu)
if int(participant.cl_max_cpu) > 0:
if cl_max_cpu > 0: config_args["max_cpu"] = int(participant.cl_max_cpu)
config_args["max_cpu"] = cl_max_cpu if int(participant.cl_min_mem) > 0:
config_args["min_memory"] = int(participant.cl_min_mem)
if cl_min_mem > 0: if int(participant.cl_max_mem) > 0:
config_args["min_memory"] = cl_min_mem config_args["max_memory"] = int(participant.cl_max_mem)
if cl_max_mem > 0:
config_args["max_memory"] = cl_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
......
...@@ -29,69 +29,44 @@ VERBOSITY_LEVELS = { ...@@ -29,69 +29,44 @@ VERBOSITY_LEVELS = {
def launch( def launch(
plan, plan,
launcher, launcher,
service_name, beacon_service_name,
image, participant,
participant_log_level,
global_log_level, global_log_level,
bootnode_contexts, bootnode_contexts,
el_context, el_context,
full_name, full_name,
node_keystore_files, node_keystore_files,
cl_min_cpu,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
blobber_enabled,
blobber_extra_params,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
use_separate_vc,
keymanager_enabled,
checkpoint_sync_enabled, checkpoint_sync_enabled,
checkpoint_sync_url, checkpoint_sync_url,
port_publisher, port_publisher,
participant_index, participant_index,
): ):
beacon_service_name = "{0}".format(service_name)
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.cl_log_level, global_log_level, VERBOSITY_LEVELS
) )
# Launch Beacon node # Launch Beacon node
beacon_config = get_beacon_config( beacon_config = get_beacon_config(
plan, plan,
launcher.el_cl_genesis_data, launcher,
launcher.jwt_file,
launcher.network,
image,
beacon_service_name, beacon_service_name,
participant,
log_level,
bootnode_contexts, bootnode_contexts,
el_context, el_context,
log_level, full_name,
cl_min_cpu, node_keystore_files,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
checkpoint_sync_enabled, checkpoint_sync_enabled,
checkpoint_sync_url, checkpoint_sync_url,
port_publisher, port_publisher,
launcher.preset,
participant_index, participant_index,
) )
...@@ -104,13 +79,13 @@ def launch( ...@@ -104,13 +79,13 @@ def launch(
) )
# Blobber config # Blobber config
if blobber_enabled: if participant.blobber_enabled:
blobber_service_name = "{0}-{1}".format("blobber", beacon_service_name) blobber_service_name = "{0}-{1}".format("blobber", beacon_service_name)
blobber_config = blobber_launcher.get_config( blobber_config = blobber_launcher.get_config(
blobber_service_name, blobber_service_name,
node_keystore_files, node_keystore_files,
beacon_http_url, beacon_http_url,
blobber_extra_params, participant.blobber_extra_params,
) )
blobber_service = plan.add_service(blobber_service_name, blobber_config) blobber_service = plan.add_service(blobber_service_name, blobber_config)
...@@ -146,7 +121,7 @@ def launch( ...@@ -146,7 +121,7 @@ def launch(
) )
beacon_node_metrics_info = node_metrics.new_node_metrics_info( beacon_node_metrics_info = node_metrics.new_node_metrics_info(
service_name, METRICS_PATH, beacon_metrics_url beacon_service_name, METRICS_PATH, beacon_metrics_url
) )
nodes_metrics_info = [beacon_node_metrics_info] nodes_metrics_info = [beacon_node_metrics_info]
...@@ -160,7 +135,7 @@ def launch( ...@@ -160,7 +135,7 @@ def launch(
beacon_service_name=beacon_service_name, beacon_service_name=beacon_service_name,
multiaddr=beacon_multiaddr, multiaddr=beacon_multiaddr,
peer_id=beacon_peer_id, peer_id=beacon_peer_id,
snooper_enabled=snooper_enabled, snooper_enabled=participant.snooper_enabled,
snooper_engine_context=snooper_engine_context, snooper_engine_context=snooper_engine_context,
validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid
if node_keystore_files if node_keystore_files
...@@ -170,31 +145,21 @@ def launch( ...@@ -170,31 +145,21 @@ def launch(
def get_beacon_config( def get_beacon_config(
plan, plan,
el_cl_genesis_data, launcher,
jwt_file, beacon_service_name,
network, participant,
image, log_level,
service_name,
bootnode_contexts, bootnode_contexts,
el_context, el_context,
log_level, full_name,
cl_min_cpu, node_keystore_files,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
checkpoint_sync_enabled, checkpoint_sync_enabled,
checkpoint_sync_url, checkpoint_sync_url,
port_publisher, port_publisher,
preset,
participant_index, participant_index,
): ):
el_client_rpc_url_str = "http://{0}:{1}".format( el_client_rpc_url_str = "http://{0}:{1}".format(
...@@ -203,7 +168,7 @@ def get_beacon_config( ...@@ -203,7 +168,7 @@ def get_beacon_config(
) )
# If snooper is enabled use the snooper engine context, otherwise use the execution client context # If snooper is enabled use the snooper engine context, otherwise use the execution client context
if snooper_enabled: if participant.snooper_enabled:
EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format( EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format(
snooper_engine_context.ip_addr, snooper_engine_context.ip_addr,
snooper_engine_context.engine_rpc_port_num, snooper_engine_context.engine_rpc_port_num,
...@@ -261,24 +226,32 @@ def get_beacon_config( ...@@ -261,24 +226,32 @@ def get_beacon_config(
# ^^^^^^^^^^^^^^^^^^^ METRICS CONFIG ^^^^^^^^^^^^^^^^^^^^^ # ^^^^^^^^^^^^^^^^^^^ METRICS CONFIG ^^^^^^^^^^^^^^^^^^^^^
] ]
supernode_cmd = [
"--supernode",
]
if participant.supernode:
cmd.extend(supernode_cmd)
# If checkpoint sync is enabled, add the checkpoint sync url # If checkpoint sync is enabled, add the checkpoint sync url
if checkpoint_sync_enabled: if checkpoint_sync_enabled:
if checkpoint_sync_url: if checkpoint_sync_url:
cmd.append("--checkpointSyncUrl=" + checkpoint_sync_url) cmd.append("--checkpointSyncUrl=" + checkpoint_sync_url)
else: else:
if ( if (
network in constants.PUBLIC_NETWORKS launcher.network in constants.PUBLIC_NETWORKS
or network == constants.NETWORK_NAME.ephemery or launcher.network == constants.NETWORK_NAME.ephemery
): ):
cmd.append( cmd.append(
"--checkpointSyncUrl=" + constants.CHECKPOINT_SYNC_URL[network] "--checkpointSyncUrl="
+ constants.CHECKPOINT_SYNC_URL[launcher.network]
) )
else: else:
fail( fail(
"Checkpoint sync URL is required if you enabled checkpoint_sync for custom networks. Please provide a valid URL." "Checkpoint sync URL is required if you enabled checkpoint_sync for custom networks. Please provide a valid URL."
) )
if network not in constants.PUBLIC_NETWORKS: if launcher.network not in constants.PUBLIC_NETWORKS:
cmd.append( cmd.append(
"--paramsFile=" "--paramsFile="
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
...@@ -290,8 +263,8 @@ def get_beacon_config( ...@@ -290,8 +263,8 @@ def get_beacon_config(
+ "/genesis.ssz" + "/genesis.ssz"
) )
if ( if (
network == constants.NETWORK_NAME.kurtosis launcher.network == constants.NETWORK_NAME.kurtosis
or constants.NETWORK_NAME.shadowfork in network or constants.NETWORK_NAME.shadowfork in launcher.network
): ):
if bootnode_contexts != None: if bootnode_contexts != None:
cmd.append( cmd.append(
...@@ -303,47 +276,53 @@ def get_beacon_config( ...@@ -303,47 +276,53 @@ def get_beacon_config(
] ]
) )
) )
elif network == constants.NETWORK_NAME.ephemery: elif launcher.network == constants.NETWORK_NAME.ephemery:
cmd.append( cmd.append(
"--bootnodes=" "--bootnodes="
+ shared_utils.get_devnet_enrs_list( + shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid plan, launcher.el_cl_genesis_data.files_artifact_uuid
) )
) )
else: # Devnets else: # Devnets
cmd.append( cmd.append(
"--bootnodes=" "--bootnodes="
+ shared_utils.get_devnet_enrs_list( + shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid plan, launcher.el_cl_genesis_data.files_artifact_uuid
) )
) )
else: # Public testnet else: # Public testnet
cmd.append("--network=" + network) cmd.append("--network=" + launcher.network)
if len(extra_params) > 0: if len(participant.cl_extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark # this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.cl_extra_params])
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
} }
if persistent: if persistent:
files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory( files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(beacon_service_name),
size=cl_volume_size, size=int(participant.cl_volume_size)
if int(participant.cl_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.CL_TYPE.lodestar + "_volume_size"
],
) )
if preset == "minimal": env_vars = participant.cl_extra_env_vars
extra_env_vars["LODESTAR_PRESET"] = "minimal"
if launcher.preset == "minimal":
env_vars["LODESTAR_PRESET"] = "minimal"
config_args = { config_args = {
"image": image, "image": participant.cl_image,
"ports": used_ports, "ports": used_ports,
"public_ports": public_ports, "public_ports": public_ports,
"cmd": cmd, "cmd": cmd,
"files": files, "files": files,
"env_vars": extra_env_vars, "env_vars": env_vars,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"ready_conditions": cl_node_ready_conditions.get_ready_conditions( "ready_conditions": cl_node_ready_conditions.get_ready_conditions(
constants.HTTP_PORT_ID constants.HTTP_PORT_ID
...@@ -351,26 +330,22 @@ def get_beacon_config( ...@@ -351,26 +330,22 @@ def get_beacon_config(
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.CL_TYPE.lodestar, constants.CL_TYPE.lodestar,
constants.CLIENT_TYPES.cl, constants.CLIENT_TYPES.cl,
image, participant.cl_image,
el_context.client_name, el_context.client_name,
extra_labels, participant.cl_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if cl_min_cpu > 0: if int(participant.cl_min_cpu) > 0:
config_args["min_cpu"] = cl_min_cpu config_args["min_cpu"] = int(participant.cl_min_cpu)
if int(participant.cl_max_cpu) > 0:
if cl_max_cpu > 0: config_args["max_cpu"] = int(participant.cl_max_cpu)
config_args["max_cpu"] = cl_max_cpu if int(participant.cl_min_mem) > 0:
config_args["min_memory"] = int(participant.cl_min_mem)
if cl_min_mem > 0: if int(participant.cl_max_mem) > 0:
config_args["min_memory"] = cl_min_mem config_args["max_memory"] = int(participant.cl_max_mem)
if cl_max_mem > 0:
config_args["max_memory"] = cl_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
......
...@@ -49,68 +49,38 @@ ENTRYPOINT_ARGS = ["sh", "-c"] ...@@ -49,68 +49,38 @@ ENTRYPOINT_ARGS = ["sh", "-c"]
def launch( def launch(
plan, plan,
launcher, launcher,
service_name, beacon_service_name,
image, participant,
participant_log_level,
global_log_level, global_log_level,
bootnode_contexts, bootnode_contexts,
el_context, el_context,
full_name, full_name,
node_keystore_files, node_keystore_files,
cl_min_cpu,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
blobber_enabled,
blobber_extra_params,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
use_separate_vc,
keymanager_enabled,
checkpoint_sync_enabled, checkpoint_sync_enabled,
checkpoint_sync_url, checkpoint_sync_url,
port_publisher, port_publisher,
participant_index, participant_index,
): ):
beacon_service_name = "{0}".format(service_name)
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.cl_log_level, global_log_level, VERBOSITY_LEVELS
) )
beacon_config = get_beacon_config( beacon_config = get_beacon_config(
plan, plan,
launcher.el_cl_genesis_data, launcher,
launcher.jwt_file,
keymanager_enabled,
launcher.keymanager_file,
launcher.network,
image,
beacon_service_name, beacon_service_name,
participant,
log_level,
bootnode_contexts, bootnode_contexts,
el_context, el_context,
full_name, full_name,
log_level,
node_keystore_files, node_keystore_files,
cl_min_cpu,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
extra_params,
extra_env_vars,
extra_labels,
use_separate_vc,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
checkpoint_sync_enabled, checkpoint_sync_enabled,
...@@ -139,14 +109,14 @@ def launch( ...@@ -139,14 +109,14 @@ def launch(
}, },
) )
response = plan.request( response = plan.request(
recipe=beacon_node_identity_recipe, service_name=service_name recipe=beacon_node_identity_recipe, service_name=beacon_service_name
) )
beacon_node_enr = response["extract.enr"] beacon_node_enr = response["extract.enr"]
beacon_multiaddr = response["extract.multiaddr"] beacon_multiaddr = response["extract.multiaddr"]
beacon_peer_id = response["extract.peer_id"] beacon_peer_id = response["extract.peer_id"]
nimbus_node_metrics_info = node_metrics.new_node_metrics_info( nimbus_node_metrics_info = node_metrics.new_node_metrics_info(
service_name, BEACON_METRICS_PATH, beacon_metrics_url beacon_service_name, BEACON_METRICS_PATH, beacon_metrics_url
) )
nodes_metrics_info = [nimbus_node_metrics_info] nodes_metrics_info = [nimbus_node_metrics_info]
...@@ -160,7 +130,7 @@ def launch( ...@@ -160,7 +130,7 @@ def launch(
beacon_service_name=beacon_service_name, beacon_service_name=beacon_service_name,
multiaddr=beacon_multiaddr, multiaddr=beacon_multiaddr,
peer_id=beacon_peer_id, peer_id=beacon_peer_id,
snooper_enabled=snooper_enabled, snooper_enabled=participant.snooper_enabled,
snooper_engine_context=snooper_engine_context, snooper_engine_context=snooper_engine_context,
validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid
if node_keystore_files if node_keystore_files
...@@ -170,30 +140,16 @@ def launch( ...@@ -170,30 +140,16 @@ def launch(
def get_beacon_config( def get_beacon_config(
plan, plan,
el_cl_genesis_data, launcher,
jwt_file, beacon_service_name,
keymanager_enabled, participant,
keymanager_file, log_level,
network,
image,
service_name,
bootnode_contexts, bootnode_contexts,
el_context, el_context,
full_name, full_name,
log_level,
node_keystore_files, node_keystore_files,
cl_min_cpu,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
extra_params,
extra_env_vars,
extra_labels,
use_separate_vc,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
checkpoint_sync_enabled, checkpoint_sync_enabled,
...@@ -213,7 +169,7 @@ def get_beacon_config( ...@@ -213,7 +169,7 @@ def get_beacon_config(
node_keystore_files.raw_secrets_relative_dirpath, node_keystore_files.raw_secrets_relative_dirpath,
) )
# If snooper is enabled use the snooper engine context, otherwise use the execution client context # If snooper is enabled use the snooper engine context, otherwise use the execution client context
if snooper_enabled: if participant.snooper_enabled:
EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format( EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format(
snooper_engine_context.ip_addr, snooper_engine_context.ip_addr,
snooper_engine_context.engine_rpc_port_num, snooper_engine_context.engine_rpc_port_num,
...@@ -252,8 +208,8 @@ def get_beacon_config( ...@@ -252,8 +208,8 @@ def get_beacon_config(
"--udp-port={0}".format(discovery_port), "--udp-port={0}".format(discovery_port),
"--tcp-port={0}".format(discovery_port), "--tcp-port={0}".format(discovery_port),
"--network={0}".format( "--network={0}".format(
network launcher.network
if network in constants.PUBLIC_NETWORKS if launcher.network in constants.PUBLIC_NETWORKS
else constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER else constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
), ),
"--data-dir=" + BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER, "--data-dir=" + BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER,
...@@ -294,15 +250,22 @@ def get_beacon_config( ...@@ -294,15 +250,22 @@ def get_beacon_config(
"--keymanager-token-file=" + constants.KEYMANAGER_MOUNT_PATH_ON_CONTAINER, "--keymanager-token-file=" + constants.KEYMANAGER_MOUNT_PATH_ON_CONTAINER,
] ]
if network not in constants.PUBLIC_NETWORKS: supernode_cmd = [
"--subscribe-all-subnets",
]
if participant.supernode:
cmd.extend(supernode_cmd)
if launcher.network not in constants.PUBLIC_NETWORKS:
cmd.append( cmd.append(
"--bootstrap-file=" "--bootstrap-file="
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/bootstrap_nodes.txt" + "/bootstrap_nodes.txt"
) )
if ( if (
network == constants.NETWORK_NAME.kurtosis launcher.network == constants.NETWORK_NAME.kurtosis
or constants.NETWORK_NAME.shadowfork in network or constants.NETWORK_NAME.shadowfork in launcher.network
): ):
if bootnode_contexts == None: if bootnode_contexts == None:
cmd.append("--subscribe-all-subnets") cmd.append("--subscribe-all-subnets")
...@@ -310,22 +273,22 @@ def get_beacon_config( ...@@ -310,22 +273,22 @@ def get_beacon_config(
for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]: for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]:
cmd.append("--bootstrap-node=" + ctx.enr) cmd.append("--bootstrap-node=" + ctx.enr)
if len(extra_params) > 0: if len(participant.cl_extra_params) > 0:
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.cl_extra_params])
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
} }
if node_keystore_files != None and not use_separate_vc: if node_keystore_files != None and not participant.use_separate_vc:
cmd.extend(validator_default_cmd) cmd.extend(validator_default_cmd)
files[ files[
VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS
] = node_keystore_files.files_artifact_uuid ] = node_keystore_files.files_artifact_uuid
files[constants.KEYMANAGER_MOUNT_PATH_ON_CLIENTS] = keymanager_file files[constants.KEYMANAGER_MOUNT_PATH_ON_CLIENTS] = launcher.keymanager_file
if keymanager_enabled: if participant.keymanager_enabled:
cmd.extend(keymanager_api_cmd) cmd.extend(keymanager_api_cmd)
used_ports.update(vc_shared.VALIDATOR_KEYMANAGER_USED_PORTS) used_ports.update(vc_shared.VALIDATOR_KEYMANAGER_USED_PORTS)
public_ports.update( public_ports.update(
...@@ -334,17 +297,21 @@ def get_beacon_config( ...@@ -334,17 +297,21 @@ def get_beacon_config(
if persistent: if persistent:
files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory( files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(beacon_service_name),
size=cl_volume_size, size=int(participant.cl_volume_size)
if int(participant.cl_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.CL_TYPE.nimbus + "_volume_size"
],
) )
config_args = { config_args = {
"image": image, "image": participant.cl_image,
"ports": used_ports, "ports": used_ports,
"public_ports": public_ports, "public_ports": public_ports,
"cmd": cmd, "cmd": cmd,
"files": files, "files": files,
"env_vars": extra_env_vars, "env_vars": participant.cl_extra_env_vars,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"ready_conditions": cl_node_ready_conditions.get_ready_conditions( "ready_conditions": cl_node_ready_conditions.get_ready_conditions(
constants.HTTP_PORT_ID constants.HTTP_PORT_ID
...@@ -352,27 +319,23 @@ def get_beacon_config( ...@@ -352,27 +319,23 @@ def get_beacon_config(
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.CL_TYPE.nimbus, constants.CL_TYPE.nimbus,
constants.CLIENT_TYPES.cl, constants.CLIENT_TYPES.cl,
image, participant.cl_image,
el_context.client_name, el_context.client_name,
extra_labels, participant.cl_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
"user": User(uid=0, gid=0), "user": User(uid=0, gid=0),
} }
if cl_min_cpu > 0: if int(participant.cl_min_cpu) > 0:
config_args["min_cpu"] = cl_min_cpu config_args["min_cpu"] = int(participant.cl_min_cpu)
if int(participant.cl_max_cpu) > 0:
if cl_max_cpu > 0: config_args["max_cpu"] = int(participant.cl_max_cpu)
config_args["max_cpu"] = cl_max_cpu if int(participant.cl_min_mem) > 0:
config_args["min_memory"] = int(participant.cl_min_mem)
if cl_min_mem > 0: if int(participant.cl_max_mem) > 0:
config_args["min_memory"] = cl_min_mem config_args["max_memory"] = int(participant.cl_max_mem)
if cl_max_mem > 0:
config_args["max_memory"] = cl_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
......
...@@ -33,68 +33,43 @@ VERBOSITY_LEVELS = { ...@@ -33,68 +33,43 @@ VERBOSITY_LEVELS = {
def launch( def launch(
plan, plan,
launcher, launcher,
service_name, beacon_service_name,
image, participant,
participant_log_level,
global_log_level, global_log_level,
bootnode_contexts, bootnode_contexts,
el_context, el_context,
full_name, full_name,
node_keystore_files, node_keystore_files,
cl_min_cpu,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
blobber_enabled,
blobber_extra_params,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
use_separate_vc,
keymanager_enabled,
checkpoint_sync_enabled, checkpoint_sync_enabled,
checkpoint_sync_url, checkpoint_sync_url,
port_publisher, port_publisher,
participant_index, participant_index,
): ):
beacon_service_name = "{0}".format(service_name)
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.cl_log_level, global_log_level, VERBOSITY_LEVELS
) )
beacon_config = get_beacon_config( beacon_config = get_beacon_config(
plan, plan,
launcher.el_cl_genesis_data, launcher,
launcher.jwt_file,
launcher.network,
image,
beacon_service_name, beacon_service_name,
participant,
log_level,
bootnode_contexts, bootnode_contexts,
el_context, el_context,
log_level, full_name,
cl_min_cpu, node_keystore_files,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
checkpoint_sync_enabled, checkpoint_sync_enabled,
checkpoint_sync_url, checkpoint_sync_url,
port_publisher, port_publisher,
launcher.preset,
participant_index, participant_index,
) )
...@@ -142,7 +117,7 @@ def launch( ...@@ -142,7 +117,7 @@ def launch(
beacon_grpc_url=beacon_grpc_url, beacon_grpc_url=beacon_grpc_url,
multiaddr=beacon_multiaddr, multiaddr=beacon_multiaddr,
peer_id=beacon_peer_id, peer_id=beacon_peer_id,
snooper_enabled=snooper_enabled, snooper_enabled=participant.snooper_enabled,
snooper_engine_context=snooper_engine_context, snooper_engine_context=snooper_engine_context,
validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid
if node_keystore_files if node_keystore_files
...@@ -152,35 +127,25 @@ def launch( ...@@ -152,35 +127,25 @@ def launch(
def get_beacon_config( def get_beacon_config(
plan, plan,
el_cl_genesis_data, launcher,
jwt_file, beacon_service_name,
network, participant,
beacon_image, log_level,
service_name,
bootnode_contexts, bootnode_contexts,
el_context, el_context,
log_level, full_name,
cl_min_cpu, node_keystore_files,
cl_max_cpu,
cl_min_mem,
cl_max_mem,
snooper_enabled,
snooper_engine_context, snooper_engine_context,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
cl_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
checkpoint_sync_enabled, checkpoint_sync_enabled,
checkpoint_sync_url, checkpoint_sync_url,
port_publisher, port_publisher,
preset,
participant_index, participant_index,
): ):
# If snooper is enabled use the snooper engine context, otherwise use the execution client context # If snooper is enabled use the snooper engine context, otherwise use the execution client context
if snooper_enabled: if participant.snooper_enabled:
EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format( EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format(
snooper_engine_context.ip_addr, snooper_engine_context.ip_addr,
snooper_engine_context.engine_rpc_port_num, snooper_engine_context.engine_rpc_port_num,
...@@ -249,33 +214,43 @@ def get_beacon_config( ...@@ -249,33 +214,43 @@ def get_beacon_config(
"--pprofport={0}".format(PROFILING_PORT_NUM), "--pprofport={0}".format(PROFILING_PORT_NUM),
] ]
supernode_cmd = [
"--subscribe-all-subnets=true",
]
if participant.supernode:
cmd.extend(supernode_cmd)
# If checkpoint sync is enabled, add the checkpoint sync url # If checkpoint sync is enabled, add the checkpoint sync url
if checkpoint_sync_enabled: if checkpoint_sync_enabled:
if checkpoint_sync_url: if checkpoint_sync_url:
cmd.append("--checkpoint-sync-url=" + checkpoint_sync_url) cmd.append("--checkpoint-sync-url=" + checkpoint_sync_url)
cmd.append( cmd.append(
"--genesis-beacon-api-url=" + constants.CHECKPOINT_SYNC_URL[network] "--genesis-beacon-api-url="
+ constants.CHECKPOINT_SYNC_URL[launcher.network]
) )
else: else:
if ( if (
network in constants.PUBLIC_NETWORKS launcher.network in constants.PUBLIC_NETWORKS
or network == constants.NETWORK_NAME.ephemery or launcher.network == constants.NETWORK_NAME.ephemery
): ):
cmd.append( cmd.append(
"--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network] "--checkpoint-sync-url="
+ constants.CHECKPOINT_SYNC_URL[launcher.network]
) )
cmd.append( cmd.append(
"--genesis-beacon-api-url=" + constants.CHECKPOINT_SYNC_URL[network] "--genesis-beacon-api-url="
+ constants.CHECKPOINT_SYNC_URL[launcher.network]
) )
else: else:
fail( fail(
"Checkpoint sync URL is required if you enabled checkpoint_sync for custom networks. Please provide a valid URL." "Checkpoint sync URL is required if you enabled checkpoint_sync for custom networks. Please provide a valid URL."
) )
if preset == "minimal": if launcher.preset == "minimal":
cmd.append("--minimal-config=true") cmd.append("--minimal-config=true")
if network not in constants.PUBLIC_NETWORKS: if launcher.network not in constants.PUBLIC_NETWORKS:
cmd.append("--p2p-static-id=true") cmd.append("--p2p-static-id=true")
cmd.append( cmd.append(
"--chain-config-file=" "--chain-config-file="
...@@ -289,15 +264,16 @@ def get_beacon_config( ...@@ -289,15 +264,16 @@ def get_beacon_config(
) )
cmd.append("--contract-deployment-block=0") cmd.append("--contract-deployment-block=0")
if ( if (
network == constants.NETWORK_NAME.kurtosis launcher.network == constants.NETWORK_NAME.kurtosis
or constants.NETWORK_NAME.shadowfork in network or constants.NETWORK_NAME.shadowfork in launcher.network
): ):
if bootnode_contexts != None: if bootnode_contexts != None:
for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]: for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]:
cmd.append("--bootstrap-node=" + ctx.enr) cmd.append("--bootstrap-node=" + ctx.enr)
elif network == constants.NETWORK_NAME.ephemery: elif launcher.network == constants.NETWORK_NAME.ephemery:
cmd.append( cmd.append(
"--genesis-beacon-api-url=" + constants.CHECKPOINT_SYNC_URL[network] "--genesis-beacon-api-url="
+ constants.CHECKPOINT_SYNC_URL[launcher.network]
) )
cmd.append( cmd.append(
"--bootstrap-node=" "--bootstrap-node="
...@@ -311,30 +287,34 @@ def get_beacon_config( ...@@ -311,30 +287,34 @@ def get_beacon_config(
+ "/bootstrap_nodes.yaml" + "/bootstrap_nodes.yaml"
) )
else: # Public network else: # Public network
cmd.append("--{}".format(network)) cmd.append("--{}".format(launcher.network))
if len(extra_params) > 0: if len(participant.cl_extra_params) > 0:
# we do the for loop as otherwise its a proto repeated array # we do the for loop as otherwise its a proto repeated array
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.cl_extra_params])
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
} }
if persistent: if persistent:
files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory( files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(beacon_service_name),
size=cl_volume_size, size=int(participant.cl_volume_size)
if int(participant.cl_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.CL_TYPE.prysm + "_volume_size"
],
) )
config_args = { config_args = {
"image": beacon_image, "image": participant.cl_image,
"ports": used_ports, "ports": used_ports,
"public_ports": public_ports, "public_ports": public_ports,
"cmd": cmd, "cmd": cmd,
"files": files, "files": files,
"env_vars": extra_env_vars, "env_vars": participant.cl_extra_env_vars,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"ready_conditions": cl_node_ready_conditions.get_ready_conditions( "ready_conditions": cl_node_ready_conditions.get_ready_conditions(
constants.HTTP_PORT_ID constants.HTTP_PORT_ID
...@@ -342,26 +322,22 @@ def get_beacon_config( ...@@ -342,26 +322,22 @@ def get_beacon_config(
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.CL_TYPE.prysm, constants.CL_TYPE.prysm,
constants.CLIENT_TYPES.cl, constants.CLIENT_TYPES.cl,
beacon_image, participant.cl_image,
el_context.client_name, el_context.client_name,
extra_labels, participant.cl_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if cl_min_cpu > 0: if int(participant.cl_min_cpu) > 0:
config_args["min_cpu"] = cl_min_cpu config_args["min_cpu"] = int(participant.cl_min_cpu)
if int(participant.cl_max_cpu) > 0:
if cl_max_cpu > 0: config_args["max_cpu"] = int(participant.cl_max_cpu)
config_args["max_cpu"] = cl_max_cpu if int(participant.cl_min_mem) > 0:
config_args["min_memory"] = int(participant.cl_min_mem)
if cl_min_mem > 0: if int(participant.cl_max_mem) > 0:
config_args["min_memory"] = cl_min_mem config_args["max_memory"] = int(participant.cl_max_mem)
if cl_max_mem > 0:
config_args["max_memory"] = cl_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
...@@ -369,14 +345,10 @@ def new_prysm_launcher( ...@@ -369,14 +345,10 @@ def new_prysm_launcher(
el_cl_genesis_data, el_cl_genesis_data,
jwt_file, jwt_file,
network_params, network_params,
prysm_password_relative_filepath,
prysm_password_artifact_uuid,
): ):
return struct( return struct(
el_cl_genesis_data=el_cl_genesis_data, el_cl_genesis_data=el_cl_genesis_data,
jwt_file=jwt_file, jwt_file=jwt_file,
network=network_params.network, network=network_params.network,
preset=network_params.preset, preset=network_params.preset,
prysm_password_artifact_uuid=prysm_password_artifact_uuid,
prysm_password_relative_filepath=prysm_password_relative_filepath,
) )
This diff is collapsed.
...@@ -34,49 +34,30 @@ def launch( ...@@ -34,49 +34,30 @@ def launch(
plan, plan,
launcher, launcher,
service_name, service_name,
image, participant,
participant_log_level,
global_log_level, global_log_level,
existing_el_clients, existing_el_clients,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
participant_index, participant_index,
): ):
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.el_log_level, global_log_level, VERBOSITY_LEVELS
) )
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
plan, plan,
launcher.el_cl_genesis_data, launcher,
launcher.jwt_file, participant,
launcher.network,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
log_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
...@@ -112,23 +93,13 @@ def launch( ...@@ -112,23 +93,13 @@ def launch(
def get_config( def get_config(
plan, plan,
el_cl_genesis_data, launcher,
jwt_file, participant,
network,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
log_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
...@@ -186,24 +157,26 @@ def get_config( ...@@ -186,24 +157,26 @@ def get_config(
"--engine-rpc-port={0}".format(ENGINE_HTTP_RPC_PORT_NUM), "--engine-rpc-port={0}".format(ENGINE_HTTP_RPC_PORT_NUM),
"--sync-mode=FULL", "--sync-mode=FULL",
"--data-storage-format={0}".format( "--data-storage-format={0}".format(
"VERKLE" if "verkle-gen" in network else "BONSAI" "VERKLE" if "verkle-gen" in launcher.network else "BONSAI"
), ),
"--metrics-enabled=true", "--metrics-enabled=true",
"--metrics-host=0.0.0.0", "--metrics-host=0.0.0.0",
"--metrics-port={0}".format(METRICS_PORT_NUM), "--metrics-port={0}".format(METRICS_PORT_NUM),
"--min-gas-price=1000000000", "--min-gas-price=1000000000",
"--bonsai-limit-trie-logs-enabled=false" if "verkle" not in network else "", "--bonsai-limit-trie-logs-enabled=false"
if "verkle" not in launcher.network
else "",
] ]
if network not in constants.PUBLIC_NETWORKS: if launcher.network not in constants.PUBLIC_NETWORKS:
cmd.append( cmd.append(
"--genesis-file=" "--genesis-file="
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/besu.json" + "/besu.json"
) )
else: else:
cmd.append("--network=" + network) cmd.append("--network=" + launcher.network)
if network == constants.NETWORK_NAME.kurtosis: if launcher.network == constants.NETWORK_NAME.kurtosis:
if len(existing_el_clients) > 0: if len(existing_el_clients) > 0:
cmd.append( cmd.append(
"--bootnodes=" "--bootnodes="
...@@ -215,64 +188,68 @@ def get_config( ...@@ -215,64 +188,68 @@ def get_config(
) )
) )
elif ( elif (
network not in constants.PUBLIC_NETWORKS launcher.network not in constants.PUBLIC_NETWORKS
and constants.NETWORK_NAME.shadowfork not in network and constants.NETWORK_NAME.shadowfork not in launcher.network
): ):
cmd.append( cmd.append(
"--bootnodes=" "--bootnodes="
+ shared_utils.get_devnet_enodes( + shared_utils.get_devnet_enodes(
plan, el_cl_genesis_data.files_artifact_uuid plan, launcher.el_cl_genesis_data.files_artifact_uuid
) )
) )
if len(extra_params) > 0: if len(participant.el_extra_params) > 0:
# we do this as extra_params isn't a normal [] but a proto repeated array # we do this as extra_params isn't a normal [] but a proto repeated array
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.el_extra_params])
cmd_str = " ".join(cmd) cmd_str = " ".join(cmd)
extra_env_vars = extra_env_vars | JAVA_OPTS env_vars = participant.el_extra_env_vars | JAVA_OPTS
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
} }
if persistent: if persistent:
files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory( files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(service_name),
size=el_volume_size, size=int(participant.el_volume_size)
if int(participant.el_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.EL_TYPE.besu + "_volume_size"
],
) )
config_args = { config_args = {
"image": image, "image": participant.el_image,
"ports": used_ports, "ports": used_ports,
"public_ports": public_ports, "public_ports": public_ports,
"cmd": [cmd_str], "cmd": [cmd_str],
"files": files, "files": files,
"entrypoint": ENTRYPOINT_ARGS, "entrypoint": ENTRYPOINT_ARGS,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": extra_env_vars, "env_vars": env_vars,
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.EL_TYPE.besu, constants.EL_TYPE.besu,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, participant.el_image,
cl_client_name, cl_client_name,
extra_labels, participant.el_extra_labels,
), ),
"user": User(uid=0, gid=0), "user": User(uid=0, gid=0),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if el_min_cpu > 0: if participant.el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu config_args["min_cpu"] = participant.el_min_cpu
if el_max_cpu > 0: if participant.el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu config_args["max_cpu"] = participant.el_max_cpu
if el_min_mem > 0: if participant.el_min_mem > 0:
config_args["min_memory"] = el_min_mem config_args["min_memory"] = participant.el_min_mem
if el_max_mem > 0: if participant.el_max_mem > 0:
config_args["max_memory"] = el_max_mem config_args["max_memory"] = participant.el_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
......
...@@ -110,22 +110,6 @@ def launch( ...@@ -110,22 +110,6 @@ def launch(
participant.el_tolerations, participant.tolerations, global_tolerations participant.el_tolerations, participant.tolerations, global_tolerations
) )
(
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
el_volume_size,
) = shared_utils.get_cpu_mem_resource_limits(
participant.el_min_cpu,
participant.el_max_cpu,
participant.el_min_mem,
participant.el_max_mem,
participant.el_volume_size,
network_name,
participant.el_type,
)
if el_type not in el_launchers: if el_type not in el_launchers:
fail( fail(
"Unsupported launcher '{0}', need one of '{1}'".format( "Unsupported launcher '{0}', need one of '{1}'".format(
...@@ -147,19 +131,10 @@ def launch( ...@@ -147,19 +131,10 @@ def launch(
plan, plan,
el_launcher, el_launcher,
el_service_name, el_service_name,
participant.el_image, participant,
participant.el_log_level,
global_log_level, global_log_level,
all_el_contexts, all_el_contexts,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
participant.el_extra_params,
participant.el_extra_env_vars,
participant.el_extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
......
...@@ -31,51 +31,30 @@ def launch( ...@@ -31,51 +31,30 @@ def launch(
plan, plan,
launcher, launcher,
service_name, service_name,
image, participant,
participant_log_level,
global_log_level, global_log_level,
existing_el_clients, existing_el_clients,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
participant_index, participant_index,
): ):
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.el_log_level, global_log_level, VERBOSITY_LEVELS
) )
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
plan, plan,
launcher.el_cl_genesis_data, launcher,
launcher.jwt_file, participant,
launcher.network,
launcher.networkid,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
log_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
launcher.prague_time,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
...@@ -113,25 +92,13 @@ def launch( ...@@ -113,25 +92,13 @@ def launch(
def get_config( def get_config(
plan, plan,
el_cl_genesis_data, launcher,
jwt_file, participant,
network,
networkid,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
verbosity_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
prague_time,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
...@@ -171,12 +138,12 @@ def get_config( ...@@ -171,12 +138,12 @@ def get_config(
cmd = [ cmd = [
"erigon", "erigon",
"{0}".format( "{0}".format(
"--override.prague=" + str(prague_time) "--override.prague=" + str(launcher.prague_time)
if constants.NETWORK_NAME.shadowfork in network if constants.NETWORK_NAME.shadowfork in launcher.network
else "" else ""
), ),
"--networkid={0}".format(networkid), "--networkid={0}".format(launcher.networkid),
"--log.console.verbosity=" + verbosity_level, "--log.console.verbosity=" + log_level,
"--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, "--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER,
"--port={0}".format(discovery_port), "--port={0}".format(discovery_port),
"--http.api=eth,erigon,engine,web3,net,debug,trace,txpool,admin", "--http.api=eth,erigon,engine,web3,net,debug,trace,txpool,admin",
...@@ -195,21 +162,31 @@ def get_config( ...@@ -195,21 +162,31 @@ def get_config(
"--metrics", "--metrics",
"--metrics.addr=0.0.0.0", "--metrics.addr=0.0.0.0",
"--metrics.port={0}".format(METRICS_PORT_NUM), "--metrics.port={0}".format(METRICS_PORT_NUM),
"--db.size.limit={0}MB".format(el_volume_size), "--db.size.limit={0}MB".format(
int(participant.el_volume_size)
if int(participant.el_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.EL_TYPE.besu + "_volume_size"
],
),
] ]
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
} }
if persistent: if persistent:
files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory( files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(service_name),
size=el_volume_size, size=int(participant.el_volume_size)
if int(participant.el_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.EL_TYPE.besu + "_volume_size"
],
) )
if network == constants.NETWORK_NAME.kurtosis: if launcher.network == constants.NETWORK_NAME.kurtosis:
if len(existing_el_clients) > 0: if len(existing_el_clients) > 0:
cmd.append( cmd.append(
"--bootnodes=" "--bootnodes="
...@@ -221,54 +198,55 @@ def get_config( ...@@ -221,54 +198,55 @@ def get_config(
) )
) )
elif ( elif (
network not in constants.PUBLIC_NETWORKS launcher.network not in constants.PUBLIC_NETWORKS
and constants.NETWORK_NAME.shadowfork not in network and constants.NETWORK_NAME.shadowfork not in launcher.network
): ):
cmd.append( cmd.append(
"--bootnodes=" "--bootnodes="
+ shared_utils.get_devnet_enodes( + shared_utils.get_devnet_enodes(
plan, el_cl_genesis_data.files_artifact_uuid plan, launcher.el_cl_genesis_data.files_artifact_uuid
) )
) )
if len(extra_params) > 0: if len(participant.el_extra_params) > 0:
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.el_extra_params])
if network not in constants.PUBLIC_NETWORKS: if launcher.network not in constants.PUBLIC_NETWORKS:
command_arg = [init_datadir_cmd_str, " ".join(cmd)] command_arg = [init_datadir_cmd_str, " ".join(cmd)]
command_arg_str = " && ".join(command_arg) command_arg_str = " && ".join(command_arg)
else: else:
command_arg_str = " ".join(cmd) command_arg_str = " ".join(cmd)
env_vars = participant.el_extra_env_vars
config_args = { config_args = {
"image": image, "image": participant.el_image,
"ports": used_ports, "ports": used_ports,
"public_ports": public_ports, "public_ports": public_ports,
"cmd": [command_arg_str], "cmd": [command_arg_str],
"files": files, "files": files,
"entrypoint": ENTRYPOINT_ARGS, "entrypoint": ENTRYPOINT_ARGS,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": extra_env_vars, "env_vars": env_vars,
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.EL_TYPE.erigon, constants.EL_TYPE.erigon,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, participant.el_image,
cl_client_name, cl_client_name,
extra_labels, participant.el_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
"user": User(uid=0, gid=0), "user": User(uid=0, gid=0),
} }
if el_min_cpu > 0: if participant.el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu config_args["min_cpu"] = participant.el_min_cpu
if el_max_cpu > 0: if participant.el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu config_args["max_cpu"] = participant.el_max_cpu
if el_min_mem > 0: if participant.el_min_mem > 0:
config_args["min_memory"] = el_min_mem config_args["min_memory"] = participant.el_min_mem
if el_max_mem > 0: if participant.el_max_mem > 0:
config_args["max_memory"] = el_max_mem config_args["max_memory"] = participant.el_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
......
...@@ -33,49 +33,30 @@ def launch( ...@@ -33,49 +33,30 @@ def launch(
plan, plan,
launcher, launcher,
service_name, service_name,
image, participant,
participant_log_level,
global_log_level, global_log_level,
existing_el_clients, existing_el_clients,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
participant_index, participant_index,
): ):
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.el_log_level, global_log_level, VERBOSITY_LEVELS
) )
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
plan, plan,
launcher.el_cl_genesis_data, launcher,
launcher.jwt_file, participant,
launcher.network,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
log_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
...@@ -111,23 +92,13 @@ def launch( ...@@ -111,23 +92,13 @@ def launch(
def get_config( def get_config(
plan, plan,
el_cl_genesis_data, launcher,
jwt_file, participant,
network,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
verbosity_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
...@@ -180,19 +151,19 @@ def get_config( ...@@ -180,19 +151,19 @@ def get_config(
"--extIP={0}".format(port_publisher.nat_exit_ip), "--extIP={0}".format(port_publisher.nat_exit_ip),
"--sync=full", "--sync=full",
"--isSingleNode=true", "--isSingleNode=true",
"--logLevel={0}".format(verbosity_level), "--logLevel={0}".format(log_level),
] ]
if network not in constants.PUBLIC_NETWORKS: if launcher.network not in constants.PUBLIC_NETWORKS:
cmd.append( cmd.append(
"--gethGenesis=" "--gethGenesis="
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/genesis.json", + "/genesis.json",
) )
else: else:
cmd.append("--network=" + network) cmd.append("--network=" + launcher.network)
if network == constants.NETWORK_NAME.kurtosis: if launcher.network == constants.NETWORK_NAME.kurtosis:
if len(existing_el_clients) > 0: if len(existing_el_clients) > 0:
cmd.append( cmd.append(
"--bootnodes=" "--bootnodes="
...@@ -204,59 +175,63 @@ def get_config( ...@@ -204,59 +175,63 @@ def get_config(
) )
) )
elif ( elif (
network not in constants.PUBLIC_NETWORKS launcher.network not in constants.PUBLIC_NETWORKS
and constants.NETWORK_NAME.shadowfork not in network and constants.NETWORK_NAME.shadowfork not in launcher.network
): ):
cmd.append( cmd.append(
"--bootnodes=" "--bootnodes="
+ shared_utils.get_devnet_enodes( + shared_utils.get_devnet_enodes(
plan, el_cl_genesis_data.files_artifact_uuid plan, launcher.el_cl_genesis_data.files_artifact_uuid
) )
) )
if len(extra_params) > 0: if len(participant.el_extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark # this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.el_extra_params])
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
} }
if persistent: if persistent:
files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory( files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(service_name),
size=el_volume_size, size=int(participant.el_volume_size)
if int(participant.el_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.EL_TYPE.besu + "_volume_size"
],
) )
env_vars = participant.el_extra_env_vars
config_args = { config_args = {
"image": image, "image": participant.el_image,
"ports": used_ports, "ports": used_ports,
"public_ports": public_ports, "public_ports": public_ports,
"cmd": cmd, "cmd": cmd,
"files": files, "files": files,
"entrypoint": ENTRYPOINT_ARGS, "entrypoint": ENTRYPOINT_ARGS,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": extra_env_vars, "env_vars": env_vars,
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.EL_TYPE.ethereumjs, constants.EL_TYPE.ethereumjs,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, participant.el_image,
cl_client_name, cl_client_name,
extra_labels, participant.el_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if el_min_cpu > 0: if participant.el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu config_args["min_cpu"] = participant.el_min_cpu
if el_max_cpu > 0: if participant.el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu config_args["max_cpu"] = participant.el_max_cpu
if el_min_mem > 0: if participant.el_min_mem > 0:
config_args["min_memory"] = el_min_mem config_args["min_memory"] = participant.el_min_mem
if el_max_mem > 0: if participant.el_max_mem > 0:
config_args["max_memory"] = el_max_mem config_args["max_memory"] = participant.el_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
......
This diff is collapsed.
...@@ -30,49 +30,30 @@ def launch( ...@@ -30,49 +30,30 @@ def launch(
plan, plan,
launcher, launcher,
service_name, service_name,
image, participant,
participant_log_level,
global_log_level, global_log_level,
existing_el_clients, existing_el_clients,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
participant_index, participant_index,
): ):
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.el_log_level, global_log_level, VERBOSITY_LEVELS
) )
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
plan, plan,
launcher.el_cl_genesis_data, launcher,
launcher.jwt_file, participant,
launcher.network,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
log_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
...@@ -109,23 +90,13 @@ def launch( ...@@ -109,23 +90,13 @@ def launch(
def get_config( def get_config(
plan, plan,
el_cl_genesis_data, launcher,
jwt_file, participant,
network,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
log_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
...@@ -179,15 +150,15 @@ def get_config( ...@@ -179,15 +150,15 @@ def get_config(
"--Metrics.ExposeHost=0.0.0.0", "--Metrics.ExposeHost=0.0.0.0",
] ]
if constants.NETWORK_NAME.shadowfork in network: if constants.NETWORK_NAME.shadowfork in launcher.network:
cmd.append( cmd.append(
"--Init.ChainSpecPath=" "--Init.ChainSpecPath="
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/chainspec.json" + "/chainspec.json"
) )
cmd.append("--config=" + network.split("-")[0]) cmd.append("--config=" + launcher.network.split("-")[0])
cmd.append("--Init.BaseDbPath=" + network.split("-")[0]) cmd.append("--Init.BaseDbPath=" + launcher.network.split("-")[0])
elif network not in constants.PUBLIC_NETWORKS: elif launcher.network not in constants.PUBLIC_NETWORKS:
cmd.append("--config=none.cfg") cmd.append("--config=none.cfg")
cmd.append( cmd.append(
"--Init.ChainSpecPath=" "--Init.ChainSpecPath="
...@@ -195,11 +166,11 @@ def get_config( ...@@ -195,11 +166,11 @@ def get_config(
+ "/chainspec.json" + "/chainspec.json"
) )
else: else:
cmd.append("--config=" + network) cmd.append("--config=" + launcher.network)
if ( if (
network == constants.NETWORK_NAME.kurtosis launcher.network == constants.NETWORK_NAME.kurtosis
or constants.NETWORK_NAME.shadowfork in network or constants.NETWORK_NAME.shadowfork in launcher.network
): ):
if len(existing_el_clients) > 0: if len(existing_el_clients) > 0:
cmd.append( cmd.append(
...@@ -212,58 +183,62 @@ def get_config( ...@@ -212,58 +183,62 @@ def get_config(
) )
) )
elif ( elif (
network not in constants.PUBLIC_NETWORKS launcher.network not in constants.PUBLIC_NETWORKS
and constants.NETWORK_NAME.shadowfork not in network and constants.NETWORK_NAME.shadowfork not in launcher.network
): ):
cmd.append( cmd.append(
"--Discovery.Bootnodes=" "--Discovery.Bootnodes="
+ shared_utils.get_devnet_enodes( + shared_utils.get_devnet_enodes(
plan, el_cl_genesis_data.files_artifact_uuid plan, launcher.el_cl_genesis_data.files_artifact_uuid
) )
) )
if len(extra_params) > 0: if len(participant.el_extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark # this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.el_extra_params])
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
} }
if persistent: if persistent:
files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory( files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(service_name),
size=el_volume_size, size=int(participant.el_volume_size)
if int(participant.el_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.EL_TYPE.besu + "_volume_size"
],
) )
env_vars = participant.el_extra_env_vars
config_args = { config_args = {
"image": image, "image": participant.el_image,
"ports": used_ports, "ports": used_ports,
"public_ports": public_ports, "public_ports": public_ports,
"cmd": cmd, "cmd": cmd,
"files": files, "files": files,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": extra_env_vars, "env_vars": env_vars,
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.EL_TYPE.nethermind, constants.EL_TYPE.nethermind,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, participant.el_image,
cl_client_name, cl_client_name,
extra_labels, participant.el_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if el_min_cpu > 0: if participant.el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu config_args["min_cpu"] = participant.el_min_cpu
if el_max_cpu > 0: if participant.el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu config_args["max_cpu"] = participant.el_max_cpu
if el_min_mem > 0: if participant.el_min_mem > 0:
config_args["min_memory"] = el_min_mem config_args["min_memory"] = participant.el_min_mem
if el_max_mem > 0: if participant.el_max_mem > 0:
config_args["max_memory"] = el_max_mem config_args["max_memory"] = participant.el_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
......
...@@ -30,50 +30,30 @@ def launch( ...@@ -30,50 +30,30 @@ def launch(
plan, plan,
launcher, launcher,
service_name, service_name,
image, participant,
participant_log_level,
global_log_level, global_log_level,
# If empty then the node will be launched as a bootnode
existing_el_clients, existing_el_clients,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
participant_index, participant_index,
): ):
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.el_log_level, global_log_level, VERBOSITY_LEVELS
) )
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
plan, plan,
launcher.el_cl_genesis_data, launcher,
launcher.jwt_file, participant,
launcher.network,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
log_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
...@@ -110,23 +90,13 @@ def launch( ...@@ -110,23 +90,13 @@ def launch(
def get_config( def get_config(
plan, plan,
el_cl_genesis_data, launcher,
jwt_file, participant,
network,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
verbosity_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
...@@ -159,7 +129,7 @@ def get_config( ...@@ -159,7 +129,7 @@ def get_config(
used_ports = shared_utils.get_port_specs(used_port_assignments) used_ports = shared_utils.get_port_specs(used_port_assignments)
cmd = [ cmd = [
"--log-level={0}".format(verbosity_level), "--log-level={0}".format(log_level),
"--data-dir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, "--data-dir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER,
"--http-port={0}".format(WS_RPC_PORT_NUM), "--http-port={0}".format(WS_RPC_PORT_NUM),
"--http-address=0.0.0.0", "--http-address=0.0.0.0",
...@@ -177,16 +147,16 @@ def get_config( ...@@ -177,16 +147,16 @@ def get_config(
"--nat=extip:{0}".format(port_publisher.nat_exit_ip), "--nat=extip:{0}".format(port_publisher.nat_exit_ip),
"--tcp-port={0}".format(discovery_port), "--tcp-port={0}".format(discovery_port),
] ]
if network not in constants.PUBLIC_NETWORKS: if launcher.network not in constants.PUBLIC_NETWORKS:
cmd.append( cmd.append(
"--custom-network=" "--custom-network="
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/genesis.json" + "/genesis.json"
) )
else: else:
cmd.append("--network=" + network) cmd.append("--network=" + launcher.network)
if network == constants.NETWORK_NAME.kurtosis: if launcher.network == constants.NETWORK_NAME.kurtosis:
if len(existing_el_clients) > 0: if len(existing_el_clients) > 0:
cmd.append( cmd.append(
"--bootstrap-node=" "--bootstrap-node="
...@@ -198,58 +168,62 @@ def get_config( ...@@ -198,58 +168,62 @@ def get_config(
) )
) )
elif ( elif (
network not in constants.PUBLIC_NETWORKS launcher.network not in constants.PUBLIC_NETWORKS
and constants.NETWORK_NAME.shadowfork not in network and constants.NETWORK_NAME.shadowfork not in launcher.network
): ):
cmd.append( cmd.append(
"--bootstrap-node=" "--bootstrap-node="
+ shared_utils.get_devnet_enodes( + shared_utils.get_devnet_enodes(
plan, el_cl_genesis_data.files_artifact_uuid plan, launcher.el_cl_genesis_data.files_artifact_uuid
) )
) )
if len(extra_params) > 0: if len(participant.el_extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark # this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.el_extra_params])
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
} }
if persistent: if persistent:
files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory( files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(service_name),
size=el_volume_size, size=int(participant.el_volume_size)
if int(participant.el_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.EL_TYPE.besu + "_volume_size"
],
) )
env_vars = participant.el_extra_env_vars
config_args = { config_args = {
"image": image, "image": participant.el_image,
"ports": used_ports, "ports": used_ports,
"public_ports": public_ports, "public_ports": public_ports,
"cmd": cmd, "cmd": cmd,
"files": files, "files": files,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": extra_env_vars, "env_vars": env_vars,
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.EL_TYPE.nimbus, constants.EL_TYPE.nimbus,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, participant.el_image,
cl_client_name, cl_client_name,
extra_labels, participant.el_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if el_min_cpu > 0: if participant.el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu config_args["min_cpu"] = participant.el_min_cpu
if el_max_cpu > 0: if participant.el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu config_args["max_cpu"] = participant.el_max_cpu
if el_min_mem > 0: if participant.el_min_mem > 0:
config_args["min_memory"] = el_min_mem config_args["min_memory"] = participant.el_min_mem
if el_max_mem > 0: if participant.el_max_mem > 0:
config_args["max_memory"] = el_max_mem config_args["max_memory"] = participant.el_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
......
...@@ -34,53 +34,32 @@ def launch( ...@@ -34,53 +34,32 @@ def launch(
plan, plan,
launcher, launcher,
service_name, service_name,
image, participant,
participant_log_level,
global_log_level, global_log_level,
# If empty then the node will be launched as a bootnode
existing_el_clients, existing_el_clients,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
port_publisher, port_publisher,
participant_index, participant_index,
): ):
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.el_log_level, global_log_level, VERBOSITY_LEVELS
) )
cl_client_name = service_name.split("-")[3] cl_client_name = service_name.split("-")[3]
config = get_config( config = get_config(
plan, plan,
launcher.el_cl_genesis_data, launcher,
launcher.jwt_file, participant,
launcher.network,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
log_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
launcher.builder,
port_publisher, port_publisher,
participant_index, participant_index,
) )
...@@ -115,26 +94,15 @@ def launch( ...@@ -115,26 +94,15 @@ def launch(
def get_config( def get_config(
plan, plan,
el_cl_genesis_data, launcher,
jwt_file, participant,
network,
image,
service_name, service_name,
existing_el_clients, existing_el_clients,
cl_client_name, cl_client_name,
verbosity_level, log_level,
el_min_cpu,
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
extra_labels,
persistent, persistent,
el_volume_size,
tolerations, tolerations,
node_selectors, node_selectors,
builder,
port_publisher, port_publisher,
participant_index, participant_index,
): ):
...@@ -167,13 +135,13 @@ def get_config( ...@@ -167,13 +135,13 @@ def get_config(
used_ports = shared_utils.get_port_specs(used_port_assignments) used_ports = shared_utils.get_port_specs(used_port_assignments)
cmd = [ cmd = [
"/usr/local/bin/mev build" if builder else "reth", "/usr/local/bin/mev build" if launcher.builder else "reth",
"node", "node",
"-{0}".format(verbosity_level), "-{0}".format(log_level),
"--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, "--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER,
"--chain={0}".format( "--chain={0}".format(
network launcher.network
if network in constants.PUBLIC_NETWORKS if launcher.network in constants.PUBLIC_NETWORKS
else constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json" else constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json"
), ),
"--http", "--http",
...@@ -197,7 +165,7 @@ def get_config( ...@@ -197,7 +165,7 @@ def get_config(
"--port={0}".format(discovery_port), "--port={0}".format(discovery_port),
] ]
if network == constants.NETWORK_NAME.kurtosis: if launcher.network == constants.NETWORK_NAME.kurtosis:
if len(existing_el_clients) > 0: if len(existing_el_clients) > 0:
cmd.append( cmd.append(
"--bootnodes=" "--bootnodes="
...@@ -209,66 +177,71 @@ def get_config( ...@@ -209,66 +177,71 @@ def get_config(
) )
) )
elif ( elif (
network not in constants.PUBLIC_NETWORKS launcher.network not in constants.PUBLIC_NETWORKS
and constants.NETWORK_NAME.shadowfork not in network and constants.NETWORK_NAME.shadowfork not in launcher.network
): ):
cmd.append( cmd.append(
"--bootnodes=" "--bootnodes="
+ shared_utils.get_devnet_enodes( + shared_utils.get_devnet_enodes(
plan, el_cl_genesis_data.files_artifact_uuid plan, launcher.el_cl_genesis_data.files_artifact_uuid
) )
) )
if len(extra_params) > 0: if len(participant.el_extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark # this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.el_extra_params])
cmd_str = " ".join(cmd) cmd_str = " ".join(cmd)
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid,
constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
} }
if persistent: if persistent:
files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory( files[EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name), persistent_key="data-{0}".format(service_name),
size=el_volume_size, size=int(participant.el_volume_size)
if int(participant.el_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.EL_TYPE.besu + "_volume_size"
],
) )
if builder: if launcher.builder:
files[ files[
mev_rs_builder.MEV_BUILDER_MOUNT_DIRPATH_ON_SERVICE mev_rs_builder.MEV_BUILDER_MOUNT_DIRPATH_ON_SERVICE
] = mev_rs_builder.MEV_BUILDER_FILES_ARTIFACT_NAME ] = mev_rs_builder.MEV_BUILDER_FILES_ARTIFACT_NAME
env_vars = participant.el_extra_env_vars
config_args = { config_args = {
"image": image, "image": participant.el_image,
"ports": used_ports, "ports": used_ports,
"public_ports": public_ports, "public_ports": public_ports,
"cmd": [cmd_str], "cmd": [cmd_str],
"files": files, "files": files,
"entrypoint": ENTRYPOINT_ARGS, "entrypoint": ENTRYPOINT_ARGS,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": extra_env_vars, "env_vars": env_vars,
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.EL_TYPE.geth, constants.EL_TYPE.reth,
constants.CLIENT_TYPES.el, constants.CLIENT_TYPES.el,
image, participant.el_image,
cl_client_name, cl_client_name,
extra_labels, participant.el_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if el_min_cpu > 0: if participant.el_min_cpu > 0:
config_args["min_cpu"] = el_min_cpu config_args["min_cpu"] = participant.el_min_cpu
if el_max_cpu > 0: if participant.el_max_cpu > 0:
config_args["max_cpu"] = el_max_cpu config_args["max_cpu"] = participant.el_max_cpu
if el_min_mem > 0: if participant.el_min_mem > 0:
config_args["min_memory"] = el_min_mem config_args["min_memory"] = participant.el_min_mem
if el_max_mem > 0: if participant.el_max_mem > 0:
config_args["max_memory"] = el_max_mem config_args["max_memory"] = participant.el_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
......
...@@ -214,6 +214,7 @@ def input_parser(plan, input_args): ...@@ -214,6 +214,7 @@ def input_parser(plan, input_args):
vc_extra_env_vars=participant["vc_extra_env_vars"], vc_extra_env_vars=participant["vc_extra_env_vars"],
vc_extra_labels=participant["vc_extra_labels"], vc_extra_labels=participant["vc_extra_labels"],
builder_network_params=participant["builder_network_params"], builder_network_params=participant["builder_network_params"],
supernode=participant["supernode"],
el_min_cpu=participant["el_min_cpu"], el_min_cpu=participant["el_min_cpu"],
el_max_cpu=participant["el_max_cpu"], el_max_cpu=participant["el_max_cpu"],
el_min_mem=participant["el_min_mem"], el_min_mem=participant["el_min_mem"],
...@@ -887,6 +888,7 @@ def default_participant(): ...@@ -887,6 +888,7 @@ def default_participant():
"cl_max_cpu": 0, "cl_max_cpu": 0,
"cl_min_mem": 0, "cl_min_mem": 0,
"cl_max_mem": 0, "cl_max_mem": 0,
"supernode": False,
"use_separate_vc": None, "use_separate_vc": None,
"vc_type": "", "vc_type": "",
"vc_image": "", "vc_image": "",
......
...@@ -24,6 +24,7 @@ PARTICIPANT_CATEGORIES = { ...@@ -24,6 +24,7 @@ PARTICIPANT_CATEGORIES = {
"cl_max_cpu", "cl_max_cpu",
"cl_min_mem", "cl_min_mem",
"cl_max_mem", "cl_max_mem",
"supernode",
"use_separate_vc", "use_separate_vc",
"vc_type", "vc_type",
"vc_image", "vc_image",
......
...@@ -16,22 +16,15 @@ VERBOSITY_LEVELS = { ...@@ -16,22 +16,15 @@ VERBOSITY_LEVELS = {
def get_config( def get_config(
participant,
el_cl_genesis_data, el_cl_genesis_data,
image, image,
participant_log_level,
global_log_level, global_log_level,
beacon_http_url, beacon_http_url,
cl_context, cl_context,
el_context, el_context,
full_name, full_name,
node_keystore_files, node_keystore_files,
vc_min_cpu,
vc_max_cpu,
vc_min_mem,
vc_max_mem,
extra_params,
extra_env_vars,
extra_labels,
tolerations, tolerations,
node_selectors, node_selectors,
keymanager_enabled, keymanager_enabled,
...@@ -41,7 +34,7 @@ def get_config( ...@@ -41,7 +34,7 @@ def get_config(
vc_index, vc_index,
): ):
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.vc_log_level, global_log_level, VERBOSITY_LEVELS
) )
validator_keys_dirpath = shared_utils.path_join( validator_keys_dirpath = shared_utils.path_join(
...@@ -84,15 +77,15 @@ def get_config( ...@@ -84,15 +77,15 @@ def get_config(
"--unencrypted-http-transport", "--unencrypted-http-transport",
] ]
if len(extra_params): if len(participant.vc_extra_params):
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.vc_extra_params])
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid,
constants.VALIDATOR_KEYS_DIRPATH_ON_SERVICE_CONTAINER: node_keystore_files.files_artifact_uuid, constants.VALIDATOR_KEYS_DIRPATH_ON_SERVICE_CONTAINER: node_keystore_files.files_artifact_uuid,
} }
env = {RUST_BACKTRACE_ENVVAR_NAME: RUST_FULL_BACKTRACE_KEYWORD} env = {RUST_BACKTRACE_ENVVAR_NAME: RUST_FULL_BACKTRACE_KEYWORD}
env.update(extra_env_vars) env.update(participant.vc_extra_env_vars)
public_ports = {} public_ports = {}
public_keymanager_port_assignment = {} public_keymanager_port_assignment = {}
...@@ -130,22 +123,18 @@ def get_config( ...@@ -130,22 +123,18 @@ def get_config(
constants.CLIENT_TYPES.validator, constants.CLIENT_TYPES.validator,
image, image,
cl_context.client_name, cl_context.client_name,
extra_labels, participant.vc_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if vc_min_cpu > 0: if participant.vc_min_cpu > 0:
config_args["min_cpu"] = vc_min_cpu config_args["min_cpu"] = participant.vc_min_cpu
if participant.vc_max_cpu > 0:
if vc_max_cpu > 0: config_args["max_cpu"] = participant.vc_max_cpu
config_args["max_cpu"] = vc_max_cpu if participant.vc_min_mem > 0:
config_args["min_memory"] = participant.vc_min_mem
if vc_min_mem > 0: if participant.vc_max_mem > 0:
config_args["min_memory"] = vc_min_mem config_args["max_memory"] = participant.vc_max_mem
if vc_max_mem > 0:
config_args["max_memory"] = vc_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
...@@ -13,23 +13,16 @@ VERBOSITY_LEVELS = { ...@@ -13,23 +13,16 @@ VERBOSITY_LEVELS = {
def get_config( def get_config(
participant,
el_cl_genesis_data, el_cl_genesis_data,
keymanager_file, keymanager_file,
image, image,
participant_log_level,
global_log_level, global_log_level,
beacon_http_url, beacon_http_url,
cl_context, cl_context,
el_context, el_context,
full_name, full_name,
node_keystore_files, node_keystore_files,
vc_min_cpu,
vc_max_cpu,
vc_min_mem,
vc_max_mem,
extra_params,
extra_env_vars,
extra_labels,
tolerations, tolerations,
node_selectors, node_selectors,
keymanager_enabled, keymanager_enabled,
...@@ -38,7 +31,7 @@ def get_config( ...@@ -38,7 +31,7 @@ def get_config(
vc_index, vc_index,
): ):
log_level = input_parser.get_client_log_level_or_default( log_level = input_parser.get_client_log_level_or_default(
participant_log_level, global_log_level, VERBOSITY_LEVELS participant.vc_log_level, global_log_level, VERBOSITY_LEVELS
) )
validator_keys_dirpath = shared_utils.path_join( validator_keys_dirpath = shared_utils.path_join(
...@@ -80,9 +73,9 @@ def get_config( ...@@ -80,9 +73,9 @@ def get_config(
"--keymanager.tokenFile=" + constants.KEYMANAGER_MOUNT_PATH_ON_CONTAINER, "--keymanager.tokenFile=" + constants.KEYMANAGER_MOUNT_PATH_ON_CONTAINER,
] ]
if len(extra_params) > 0: if len(participant.vc_extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark # this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.vc_extra_params])
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid,
...@@ -114,8 +107,9 @@ def get_config( ...@@ -114,8 +107,9 @@ def get_config(
shared_utils.get_port_specs(public_keymanager_port_assignment) shared_utils.get_port_specs(public_keymanager_port_assignment)
) )
env_vars = participant.vc_extra_env_vars
if preset == "minimal": if preset == "minimal":
extra_env_vars["LODESTAR_PRESET"] = "minimal" env_vars["LODESTAR_PRESET"] = "minimal"
config_args = { config_args = {
"image": image, "image": image,
...@@ -123,28 +117,24 @@ def get_config( ...@@ -123,28 +117,24 @@ def get_config(
"public_ports": public_ports, "public_ports": public_ports,
"cmd": cmd, "cmd": cmd,
"files": files, "files": files,
"env_vars": extra_env_vars, "env_vars": env_vars,
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.CL_TYPE.lodestar, constants.CL_TYPE.lodestar,
constants.CLIENT_TYPES.validator, constants.CLIENT_TYPES.validator,
image, image,
cl_context.client_name, cl_context.client_name,
extra_labels, participant.vc_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if vc_min_cpu > 0: if participant.vc_min_cpu > 0:
config_args["min_cpu"] = vc_min_cpu config_args["min_cpu"] = participant.vc_min_cpu
if participant.vc_max_cpu > 0:
if vc_max_cpu > 0: config_args["max_cpu"] = participant.vc_max_cpu
config_args["max_cpu"] = vc_max_cpu if participant.vc_min_mem > 0:
config_args["min_memory"] = participant.vc_min_mem
if vc_min_mem > 0: if participant.vc_max_mem > 0:
config_args["min_memory"] = vc_min_mem config_args["max_memory"] = participant.vc_max_mem
if vc_max_mem > 0:
config_args["max_memory"] = vc_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
...@@ -4,6 +4,7 @@ vc_shared = import_module("./shared.star") ...@@ -4,6 +4,7 @@ vc_shared = import_module("./shared.star")
def get_config( def get_config(
participant,
el_cl_genesis_data, el_cl_genesis_data,
image, image,
keymanager_file, keymanager_file,
...@@ -12,13 +13,6 @@ def get_config( ...@@ -12,13 +13,6 @@ def get_config(
el_context, el_context,
full_name, full_name,
node_keystore_files, node_keystore_files,
vc_min_cpu,
vc_max_cpu,
vc_min_mem,
vc_max_mem,
extra_params,
extra_env_vars,
extra_labels,
tolerations, tolerations,
node_selectors, node_selectors,
keymanager_enabled, keymanager_enabled,
...@@ -57,9 +51,9 @@ def get_config( ...@@ -57,9 +51,9 @@ def get_config(
"--keymanager-token-file=" + constants.KEYMANAGER_MOUNT_PATH_ON_CONTAINER, "--keymanager-token-file=" + constants.KEYMANAGER_MOUNT_PATH_ON_CONTAINER,
] ]
if len(extra_params) > 0: if len(participant.vc_extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark # this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.vc_extra_params])
files = { files = {
constants.VALIDATOR_KEYS_DIRPATH_ON_SERVICE_CONTAINER: node_keystore_files.files_artifact_uuid, constants.VALIDATOR_KEYS_DIRPATH_ON_SERVICE_CONTAINER: node_keystore_files.files_artifact_uuid,
...@@ -96,29 +90,25 @@ def get_config( ...@@ -96,29 +90,25 @@ def get_config(
"public_ports": public_ports, "public_ports": public_ports,
"cmd": cmd, "cmd": cmd,
"files": files, "files": files,
"env_vars": extra_env_vars, "env_vars": participant.vc_extra_env_vars,
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.CL_TYPE.nimbus, constants.CL_TYPE.nimbus,
constants.CLIENT_TYPES.validator, constants.CLIENT_TYPES.validator,
image, image,
cl_context.client_name, cl_context.client_name,
extra_labels, participant.vc_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
"user": User(uid=0, gid=0), "user": User(uid=0, gid=0),
} }
if vc_min_cpu > 0: if participant.vc_min_cpu > 0:
config_args["min_cpu"] = vc_min_cpu config_args["min_cpu"] = participant.vc_min_cpu
if participant.vc_max_cpu > 0:
if vc_max_cpu > 0: config_args["max_cpu"] = participant.vc_max_cpu
config_args["max_cpu"] = vc_max_cpu if participant.vc_min_mem > 0:
config_args["min_memory"] = participant.vc_min_mem
if vc_min_mem > 0: if participant.vc_max_mem > 0:
config_args["min_memory"] = vc_min_mem config_args["max_memory"] = participant.vc_max_mem
if vc_max_mem > 0:
config_args["max_memory"] = vc_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
...@@ -7,6 +7,7 @@ PRYSM_BEACON_RPC_PORT = 4000 ...@@ -7,6 +7,7 @@ PRYSM_BEACON_RPC_PORT = 4000
def get_config( def get_config(
participant,
el_cl_genesis_data, el_cl_genesis_data,
keymanager_file, keymanager_file,
image, image,
...@@ -15,13 +16,6 @@ def get_config( ...@@ -15,13 +16,6 @@ def get_config(
el_context, el_context,
full_name, full_name,
node_keystore_files, node_keystore_files,
vc_min_cpu,
vc_max_cpu,
vc_min_mem,
vc_max_mem,
extra_params,
extra_env_vars,
extra_labels,
prysm_password_relative_filepath, prysm_password_relative_filepath,
prysm_password_artifact_uuid, prysm_password_artifact_uuid,
tolerations, tolerations,
...@@ -70,9 +64,9 @@ def get_config( ...@@ -70,9 +64,9 @@ def get_config(
cmd.append("--beacon-rpc-provider=" + cl_context.beacon_grpc_url) cmd.append("--beacon-rpc-provider=" + cl_context.beacon_grpc_url)
cmd.append("--beacon-rest-api-provider=" + cl_context.beacon_grpc_url) cmd.append("--beacon-rest-api-provider=" + cl_context.beacon_grpc_url)
if len(extra_params) > 0: if len(participant.vc_extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark # this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.vc_extra_params])
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid,
...@@ -116,28 +110,24 @@ def get_config( ...@@ -116,28 +110,24 @@ def get_config(
"public_ports": public_ports, "public_ports": public_ports,
"cmd": cmd, "cmd": cmd,
"files": files, "files": files,
"env_vars": extra_env_vars, "env_vars": participant.vc_extra_env_vars,
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.CL_TYPE.prysm, constants.CL_TYPE.prysm,
constants.CLIENT_TYPES.validator, constants.CLIENT_TYPES.validator,
image, image,
cl_context.client_name, cl_context.client_name,
extra_labels, participant.vc_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if vc_min_cpu > 0: if participant.vc_min_cpu > 0:
config_args["min_cpu"] = vc_min_cpu config_args["min_cpu"] = participant.vc_min_cpu
if participant.vc_max_cpu > 0:
if vc_max_cpu > 0: config_args["max_cpu"] = participant.vc_max_cpu
config_args["max_cpu"] = vc_max_cpu if participant.vc_min_mem > 0:
config_args["min_memory"] = participant.vc_min_mem
if vc_min_mem > 0: if participant.vc_max_mem > 0:
config_args["min_memory"] = vc_min_mem config_args["max_memory"] = participant.vc_max_mem
if vc_max_mem > 0:
config_args["max_memory"] = vc_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
...@@ -4,6 +4,7 @@ vc_shared = import_module("./shared.star") ...@@ -4,6 +4,7 @@ vc_shared = import_module("./shared.star")
def get_config( def get_config(
participant,
el_cl_genesis_data, el_cl_genesis_data,
keymanager_file, keymanager_file,
image, image,
...@@ -12,13 +13,6 @@ def get_config( ...@@ -12,13 +13,6 @@ def get_config(
el_context, el_context,
full_name, full_name,
node_keystore_files, node_keystore_files,
vc_min_cpu,
vc_max_cpu,
vc_min_mem,
vc_max_mem,
extra_params,
extra_env_vars,
extra_labels,
tolerations, tolerations,
node_selectors, node_selectors,
keymanager_enabled, keymanager_enabled,
...@@ -67,9 +61,9 @@ def get_config( ...@@ -67,9 +61,9 @@ def get_config(
"--Xvalidator-api-unsafe-hosts-enabled=true", "--Xvalidator-api-unsafe-hosts-enabled=true",
] ]
if len(extra_params) > 0: if len(participant.vc_extra_params) > 0:
# this is a repeated<proto type>, we convert it into Starlark # this is a repeated<proto type>, we convert it into Starlark
cmd.extend([param for param in extra_params]) cmd.extend([param for param in participant.vc_extra_params])
files = { files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid,
...@@ -107,28 +101,24 @@ def get_config( ...@@ -107,28 +101,24 @@ def get_config(
"public_ports": public_ports, "public_ports": public_ports,
"cmd": cmd, "cmd": cmd,
"files": files, "files": files,
"env_vars": extra_env_vars, "env_vars": participant.vc_extra_env_vars,
"labels": shared_utils.label_maker( "labels": shared_utils.label_maker(
constants.CL_TYPE.teku, constants.CL_TYPE.teku,
constants.CLIENT_TYPES.validator, constants.CLIENT_TYPES.validator,
image, image,
cl_context.client_name, cl_context.client_name,
extra_labels, participant.vc_extra_labels,
), ),
"tolerations": tolerations, "tolerations": tolerations,
"node_selectors": node_selectors, "node_selectors": node_selectors,
} }
if vc_min_cpu > 0: if participant.vc_min_cpu > 0:
config_args["min_cpu"] = vc_min_cpu config_args["min_cpu"] = participant.vc_min_cpu
if participant.vc_max_cpu > 0:
if vc_max_cpu > 0: config_args["max_cpu"] = participant.vc_max_cpu
config_args["max_cpu"] = vc_max_cpu if participant.vc_min_mem > 0:
config_args["min_memory"] = participant.vc_min_mem
if vc_min_mem > 0: if participant.vc_max_mem > 0:
config_args["min_memory"] = vc_min_mem config_args["max_memory"] = participant.vc_max_mem
if vc_max_mem > 0:
config_args["max_memory"] = vc_max_mem
return ServiceConfig(**config_args) return ServiceConfig(**config_args)
...@@ -54,44 +54,18 @@ def launch( ...@@ -54,44 +54,18 @@ def launch(
cl_context.beacon_http_url, cl_context.beacon_http_url,
) )
(
vc_min_cpu,
vc_max_cpu,
vc_min_mem,
vc_max_mem,
_,
) = shared_utils.get_cpu_mem_resource_limits(
participant.vc_min_cpu,
participant.vc_max_cpu,
participant.vc_min_mem,
participant.vc_max_mem,
0,
network,
vc_type,
)
extra_params = participant.vc_extra_params
extra_env_vars = participant.vc_extra_env_vars
extra_labels = participant.vc_extra_labels
participant_log_level = participant.vc_log_level
keymanager_enabled = participant.keymanager_enabled keymanager_enabled = participant.keymanager_enabled
if vc_type == constants.VC_TYPE.lighthouse: if vc_type == constants.VC_TYPE.lighthouse:
config = lighthouse.get_config( config = lighthouse.get_config(
participant=participant,
el_cl_genesis_data=launcher.el_cl_genesis_data, el_cl_genesis_data=launcher.el_cl_genesis_data,
image=image, image=image,
participant_log_level=participant_log_level,
global_log_level=global_log_level, global_log_level=global_log_level,
beacon_http_url=beacon_http_url, beacon_http_url=beacon_http_url,
cl_context=cl_context, cl_context=cl_context,
el_context=el_context, el_context=el_context,
full_name=full_name, full_name=full_name,
node_keystore_files=node_keystore_files, node_keystore_files=node_keystore_files,
vc_min_cpu=vc_min_cpu,
vc_max_cpu=vc_max_cpu,
vc_min_mem=vc_min_mem,
vc_max_mem=vc_max_mem,
extra_params=extra_params,
extra_env_vars=extra_env_vars,
extra_labels=extra_labels,
tolerations=tolerations, tolerations=tolerations,
node_selectors=node_selectors, node_selectors=node_selectors,
keymanager_enabled=keymanager_enabled, keymanager_enabled=keymanager_enabled,
...@@ -102,23 +76,16 @@ def launch( ...@@ -102,23 +76,16 @@ def launch(
) )
elif vc_type == constants.VC_TYPE.lodestar: elif vc_type == constants.VC_TYPE.lodestar:
config = lodestar.get_config( config = lodestar.get_config(
participant=participant,
el_cl_genesis_data=launcher.el_cl_genesis_data, el_cl_genesis_data=launcher.el_cl_genesis_data,
keymanager_file=keymanager_file, keymanager_file=keymanager_file,
image=image, image=image,
participant_log_level=participant_log_level,
global_log_level=global_log_level, global_log_level=global_log_level,
beacon_http_url=beacon_http_url, beacon_http_url=beacon_http_url,
cl_context=cl_context, cl_context=cl_context,
el_context=el_context, el_context=el_context,
full_name=full_name, full_name=full_name,
node_keystore_files=node_keystore_files, node_keystore_files=node_keystore_files,
vc_min_cpu=vc_min_cpu,
vc_max_cpu=vc_max_cpu,
vc_min_mem=vc_min_mem,
vc_max_mem=vc_max_mem,
extra_params=extra_params,
extra_env_vars=extra_env_vars,
extra_labels=extra_labels,
tolerations=tolerations, tolerations=tolerations,
node_selectors=node_selectors, node_selectors=node_selectors,
keymanager_enabled=keymanager_enabled, keymanager_enabled=keymanager_enabled,
...@@ -128,6 +95,7 @@ def launch( ...@@ -128,6 +95,7 @@ def launch(
) )
elif vc_type == constants.VC_TYPE.teku: elif vc_type == constants.VC_TYPE.teku:
config = teku.get_config( config = teku.get_config(
participant=participant,
el_cl_genesis_data=launcher.el_cl_genesis_data, el_cl_genesis_data=launcher.el_cl_genesis_data,
keymanager_file=keymanager_file, keymanager_file=keymanager_file,
image=image, image=image,
...@@ -136,13 +104,6 @@ def launch( ...@@ -136,13 +104,6 @@ def launch(
el_context=el_context, el_context=el_context,
full_name=full_name, full_name=full_name,
node_keystore_files=node_keystore_files, node_keystore_files=node_keystore_files,
vc_min_cpu=vc_min_cpu,
vc_max_cpu=vc_max_cpu,
vc_min_mem=vc_min_mem,
vc_max_mem=vc_max_mem,
extra_params=extra_params,
extra_env_vars=extra_env_vars,
extra_labels=extra_labels,
tolerations=tolerations, tolerations=tolerations,
node_selectors=node_selectors, node_selectors=node_selectors,
keymanager_enabled=keymanager_enabled, keymanager_enabled=keymanager_enabled,
...@@ -151,6 +112,7 @@ def launch( ...@@ -151,6 +112,7 @@ def launch(
) )
elif vc_type == constants.VC_TYPE.nimbus: elif vc_type == constants.VC_TYPE.nimbus:
config = nimbus.get_config( config = nimbus.get_config(
participant=participant,
el_cl_genesis_data=launcher.el_cl_genesis_data, el_cl_genesis_data=launcher.el_cl_genesis_data,
keymanager_file=keymanager_file, keymanager_file=keymanager_file,
image=image, image=image,
...@@ -159,13 +121,6 @@ def launch( ...@@ -159,13 +121,6 @@ def launch(
el_context=el_context, el_context=el_context,
full_name=full_name, full_name=full_name,
node_keystore_files=node_keystore_files, node_keystore_files=node_keystore_files,
vc_min_cpu=vc_min_cpu,
vc_max_cpu=vc_max_cpu,
vc_min_mem=vc_min_mem,
vc_max_mem=vc_max_mem,
extra_params=extra_params,
extra_env_vars=extra_env_vars,
extra_labels=extra_labels,
tolerations=tolerations, tolerations=tolerations,
node_selectors=node_selectors, node_selectors=node_selectors,
keymanager_enabled=keymanager_enabled, keymanager_enabled=keymanager_enabled,
...@@ -174,6 +129,7 @@ def launch( ...@@ -174,6 +129,7 @@ def launch(
) )
elif vc_type == constants.VC_TYPE.prysm: elif vc_type == constants.VC_TYPE.prysm:
config = prysm.get_config( config = prysm.get_config(
participant=participant,
el_cl_genesis_data=launcher.el_cl_genesis_data, el_cl_genesis_data=launcher.el_cl_genesis_data,
keymanager_file=keymanager_file, keymanager_file=keymanager_file,
image=image, image=image,
...@@ -182,13 +138,6 @@ def launch( ...@@ -182,13 +138,6 @@ def launch(
el_context=el_context, el_context=el_context,
full_name=full_name, full_name=full_name,
node_keystore_files=node_keystore_files, node_keystore_files=node_keystore_files,
vc_min_cpu=vc_min_cpu,
vc_max_cpu=vc_max_cpu,
vc_min_mem=vc_min_mem,
vc_max_mem=vc_max_mem,
extra_params=extra_params,
extra_env_vars=extra_env_vars,
extra_labels=extra_labels,
prysm_password_relative_filepath=prysm_password_relative_filepath, prysm_password_relative_filepath=prysm_password_relative_filepath,
prysm_password_artifact_uuid=prysm_password_artifact_uuid, prysm_password_artifact_uuid=prysm_password_artifact_uuid,
tolerations=tolerations, tolerations=tolerations,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment