Skip to content

Commit

Permalink
refactor: rename some module names (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa authored Oct 19, 2023
1 parent c46b6bf commit 9bf9979
Show file tree
Hide file tree
Showing 17 changed files with 196 additions and 205 deletions.
35 changes: 17 additions & 18 deletions main.star
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
parse_input = import_module("./src/package_io/parse_input.star")
input_parser = import_module("./src/package_io/input_parser.star")
constants = import_module("./src/package_io/constants.star")

participant_network = import_module("./src/participant_network.star")

static_files = import_module("./src/static_files/static_files.star")
Expand All @@ -27,14 +26,14 @@ full_beaconchain_explorer = import_module(
)
prometheus = import_module("./src/prometheus/prometheus_launcher.star")
grafana = import_module("./src/grafana/grafana_launcher.star")
mev_boost_launcher_module = import_module("./src/mev_boost/mev_boost_launcher.star")
mock_mev_launcher_module = import_module("./src/mock_mev/mock_mev_launcher.star")
mev_relay_launcher_module = import_module("./src/mev_relay/mev_relay_launcher.star")
mev_flood_module = import_module("./src/mev_flood/mev_flood_launcher.star")
mev_custom_flood_module = import_module(
mev_boost = import_module("./src/mev_boost/mev_boost_launcher.star")
mock_mev = import_module("./src/mock_mev/mock_mev_launcher.star")
mev_relay = import_module("./src/mev_relay/mev_relay_launcher.star")
mev_flood = import_module("./src/mev_flood/mev_flood_launcher.star")
mev_custom_flood = import_module(
"./src/mev_custom_flood/mev_custom_flood_launcher.star"
)
eip4788_deployment_module = import_module(
eip4788_deployment = import_module(
"./src/eip4788_deployment/eip4788_deployment_launcher.star"
)
GRAFANA_USER = "admin"
Expand All @@ -51,7 +50,7 @@ PATH_TO_PARSED_BEACON_STATE = "/genesis/output/parsedBeaconState.json"


def run(plan, args={}):
args_with_right_defaults = parse_input.parse_input(plan, args)
args_with_right_defaults = input_parser.input_parser(plan, args)

num_participants = len(args_with_right_defaults.participants)
network_params = args_with_right_defaults.network_params
Expand Down Expand Up @@ -118,7 +117,7 @@ def run(plan, args={}):
el_uri = "http://{0}:{1}".format(
all_el_client_contexts[0].ip_addr, all_el_client_contexts[0].rpc_port_num
)
eip4788_deployment_module.deploy_eip4788_contract_in_background(
eip4788_deployment.deploy_eip4788_contract_in_background(
plan,
genesis_constants.PRE_FUNDED_ACCOUNTS[5].private_key,
el_uri,
Expand Down Expand Up @@ -150,7 +149,7 @@ def run(plan, args={}):
files={"/data": el_cl_data_files_artifact_uuid},
wait=None,
)
endpoint = mock_mev_launcher_module.launch_mock_mev(
endpoint = mock_mev.launch_mock_mev(
plan,
el_uri,
beacon_uri,
Expand All @@ -177,7 +176,7 @@ def run(plan, args={}):

first_cl_client = all_cl_client_contexts[0]
first_client_beacon_name = first_cl_client.beacon_service_name
mev_flood_module.launch_mev_flood(
mev_flood.launch_mev_flood(
plan,
mev_params.mev_flood_image,
el_uri,
Expand All @@ -196,7 +195,7 @@ def run(plan, args={}):
timeout="20m",
service_name=first_client_beacon_name,
)
endpoint = mev_relay_launcher_module.launch_mev_relay(
endpoint = mev_relay.launch_mev_relay(
plan,
mev_params,
network_params.network_id,
Expand All @@ -205,7 +204,7 @@ def run(plan, args={}):
builder_uri,
network_params.seconds_per_slot,
)
mev_flood_module.spam_in_background(
mev_flood.spam_in_background(
plan,
el_uri,
mev_params.mev_flood_extra_args,
Expand All @@ -219,13 +218,13 @@ def run(plan, args={}):
if mev_endpoints:
for index, participant in enumerate(all_participants):
if args_with_right_defaults.participants[index].validator_count != 0:
mev_boost_launcher = mev_boost_launcher_module.new_mev_boost_launcher(
mev_boost_launcher = mev_boost.new_mev_boost_launcher(
MEV_BOOST_SHOULD_CHECK_RELAY, mev_endpoints
)
mev_boost_service_name = "{0}{1}".format(
parse_input.MEV_BOOST_SERVICE_NAME_PREFIX, index
input_parser.MEV_BOOST_SERVICE_NAME_PREFIX, index
)
mev_boost_context = mev_boost_launcher_module.launch(
mev_boost_context = mev_boost.launch(
plan,
mev_boost_launcher,
mev_boost_service_name,
Expand Down Expand Up @@ -330,7 +329,7 @@ def run(plan, args={}):
# Allow prometheus to be launched last so is able to collect metrics from other services
launch_prometheus_grafana = True
elif additional_service == "custom_flood":
mev_custom_flood_module.spam_in_background(
mev_custom_flood.spam_in_background(
plan,
genesis_constants.PRE_FUNDED_ACCOUNTS[-1].private_key,
genesis_constants.PRE_FUNDED_ACCOUNTS[0].address,
Expand Down
47 changes: 21 additions & 26 deletions src/cl/lighthouse/lighthouse_launcher.star
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
shared_utils = import_module("../../shared_utils/shared_utils.star")
input_parser = import_module("../../package_io/parse_input.star")
input_parser = import_module("../../package_io/input_parser.star")
cl_client_context = import_module("../../cl/cl_client_context.star")
node_metrics = import_module("../../node_metrics_info.star")
cl_node_ready_conditions = import_module("../../cl/cl_node_ready_conditions.star")

package_io = import_module("../../package_io/constants.star")
constants = import_module("../../package_io/constants.star")

LIGHTHOUSE_BINARY_COMMAND = "lighthouse"

Expand Down Expand Up @@ -84,11 +85,11 @@ VALIDATOR_USED_PORTS = {
}

LIGHTHOUSE_LOG_LEVELS = {
package_io.GLOBAL_CLIENT_LOG_LEVEL.error: "error",
package_io.GLOBAL_CLIENT_LOG_LEVEL.warn: "warn",
package_io.GLOBAL_CLIENT_LOG_LEVEL.info: "info",
package_io.GLOBAL_CLIENT_LOG_LEVEL.debug: "debug",
package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "trace",
constants.GLOBAL_CLIENT_LOG_LEVEL.error: "error",
constants.GLOBAL_CLIENT_LOG_LEVEL.warn: "warn",
constants.GLOBAL_CLIENT_LOG_LEVEL.info: "info",
constants.GLOBAL_CLIENT_LOG_LEVEL.debug: "debug",
constants.GLOBAL_CLIENT_LOG_LEVEL.trace: "trace",
}


Expand Down Expand Up @@ -266,7 +267,7 @@ def get_beacon_config(
"beacon_node",
"--debug-level=" + log_level,
"--datadir=" + CONSENSUS_DATA_DIRPATH_ON_BEACON_SERVICE_CONTAINER,
"--testnet-dir=" + package_io.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER,
"--testnet-dir=" + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER,
# vvvvvvvvvvvvvvvvvvv REMOVE THESE WHEN CONNECTING TO EXTERNAL NET vvvvvvvvvvvvvvvvvvvvv
"--disable-enr-auto-update",
"--enr-address=" + PRIVATE_IP_ADDRESS_PLACEHOLDER,
Expand All @@ -281,14 +282,14 @@ def get_beacon_config(
"--http-address=0.0.0.0",
"--http-port={0}".format(BEACON_HTTP_PORT_NUM),
"--http-allow-sync-stalled",
"--slots-per-restore-point={0}".format(32 if package_io.ARCHIVE_MODE else 8192),
"--slots-per-restore-point={0}".format(32 if constants.ARCHIVE_MODE else 8192),
# NOTE: This comes from:
# https://github.com/sigp/lighthouse/blob/7c88f582d955537f7ffff9b2c879dcf5bf80ce13/scripts/local_testnet/beacon_node.sh
# and the option says it's "useful for testing in smaller networks" (unclear what happens in larger networks)
"--disable-packet-filter",
"--execution-endpoints=" + EXECUTION_ENGINE_ENDPOINT,
"--jwt-secrets=" + package_io.JWT_AUTH_PATH,
"--suggested-fee-recipient=" + package_io.VALIDATING_REWARDS_ACCOUNT,
"--jwt-secrets=" + constants.JWT_AUTH_PATH,
"--suggested-fee-recipient=" + constants.VALIDATING_REWARDS_ACCOUNT,
# Set per Paris' recommendation to reduce noise in the logs
"--subscribe-all-subnets",
# vvvvvvvvvvvvvvvvvvv METRICS CONFIG vvvvvvvvvvvvvvvvvvvvv
Expand All @@ -303,15 +304,15 @@ def get_beacon_config(
cmd.append(
"--boot-nodes="
+ ",".join(
[ctx.enr for ctx in boot_cl_client_ctxs[: package_io.MAX_ENR_ENTRIES]]
[ctx.enr for ctx in boot_cl_client_ctxs[: constants.MAX_ENR_ENTRIES]]
)
)
cmd.append(
"--trusted-peers="
+ ",".join(
[
ctx.peer_id
for ctx in boot_cl_client_ctxs[: package_io.MAX_ENR_ENTRIES]
for ctx in boot_cl_client_ctxs[: constants.MAX_ENR_ENTRIES]
]
)
)
Expand All @@ -324,24 +325,18 @@ def get_beacon_config(
endpoint="/eth/v1/node/identity", port_id=BEACON_HTTP_PORT_ID
)

ready_conditions = ReadyCondition(
recipe=recipe,
field="code",
assertion="IN",
target_value=[200, 206],
timeout="15m",
)

return ServiceConfig(
image=image,
ports=BEACON_USED_PORTS,
cmd=cmd,
files={
package_io.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
},
env_vars={RUST_BACKTRACE_ENVVAR_NAME: RUST_FULL_BACKTRACE_KEYWORD},
private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER,
ready_conditions=ready_conditions,
ready_conditions=cl_node_ready_conditions.get_ready_conditions(
BEACON_HTTP_PORT_ID
),
min_cpu=bn_min_cpu,
max_cpu=bn_max_cpu,
min_memory=bn_min_mem,
Expand Down Expand Up @@ -374,7 +369,7 @@ def get_validator_config(
"lighthouse",
"validator_client",
"--debug-level=" + log_level,
"--testnet-dir=" + package_io.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER,
"--testnet-dir=" + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER,
"--validators-dir=" + validator_keys_dirpath,
# NOTE: When secrets-dir is specified, we can't add the --data-dir flag
"--secrets-dir=" + validator_secrets_dirpath,
Expand All @@ -387,7 +382,7 @@ def get_validator_config(
"--beacon-nodes=" + beacon_client_http_url,
# "--enable-doppelganger-protection", // Disabled to not have to wait 2 epochs before validator can start
# burn address - If unset, the validator will scream in its logs
"--suggested-fee-recipient=" + package_io.VALIDATING_REWARDS_ACCOUNT,
"--suggested-fee-recipient=" + constants.VALIDATING_REWARDS_ACCOUNT,
# vvvvvvvvvvvvvvvvvvv PROMETHEUS CONFIG vvvvvvvvvvvvvvvvvvvvv
"--metrics",
"--metrics-address=0.0.0.0",
Expand All @@ -404,7 +399,7 @@ def get_validator_config(
ports=VALIDATOR_USED_PORTS,
cmd=cmd,
files={
package_io.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,
VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS: node_keystore_files.files_artifact_uuid,
},
env_vars={RUST_BACKTRACE_ENVVAR_NAME: RUST_FULL_BACKTRACE_KEYWORD},
Expand Down
30 changes: 15 additions & 15 deletions src/cl/lodestar/lodestar_launcher.star
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
shared_utils = import_module("../../shared_utils/shared_utils.star")
input_parser = import_module("../../package_io/parse_input.star")
input_parser = import_module("../../package_io/input_parser.star")
cl_client_context = import_module("../../cl/cl_client_context.star")
node_metrics = import_module("../../node_metrics_info.star")
cl_node_ready_conditions = import_module("../../cl/cl_node_ready_conditions.star")

package_io = import_module("../../package_io/constants.star")
constants = import_module("../../package_io/constants.star")

# ---------------------------------- Beacon client -------------------------------------
CONSENSUS_DATA_DIRPATH_ON_SERVICE_CONTAINER = "/consensus-data"
Expand Down Expand Up @@ -61,11 +61,11 @@ VALIDATOR_USED_PORTS = {


LODESTAR_LOG_LEVELS = {
package_io.GLOBAL_CLIENT_LOG_LEVEL.error: "error",
package_io.GLOBAL_CLIENT_LOG_LEVEL.warn: "warn",
package_io.GLOBAL_CLIENT_LOG_LEVEL.info: "info",
package_io.GLOBAL_CLIENT_LOG_LEVEL.debug: "debug",
package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "trace",
constants.GLOBAL_CLIENT_LOG_LEVEL.error: "error",
constants.GLOBAL_CLIENT_LOG_LEVEL.warn: "warn",
constants.GLOBAL_CLIENT_LOG_LEVEL.info: "info",
constants.GLOBAL_CLIENT_LOG_LEVEL.debug: "debug",
constants.GLOBAL_CLIENT_LOG_LEVEL.trace: "trace",
}


Expand Down Expand Up @@ -232,10 +232,10 @@ def get_beacon_config(
"--discoveryPort={0}".format(DISCOVERY_PORT_NUM),
"--dataDir=" + CONSENSUS_DATA_DIRPATH_ON_SERVICE_CONTAINER,
"--paramsFile="
+ package_io.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/config.yaml",
"--genesisStateFile="
+ package_io.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/genesis.ssz",
"--eth1.depositContractDeployBlock=0",
"--network.connectToDiscv5Bootnodes=true",
Expand All @@ -253,7 +253,7 @@ def get_beacon_config(
"--enr.udp={0}".format(DISCOVERY_PORT_NUM),
# Set per Pari's recommendation to reduce noise in the logs
"--subscribeAllSubnets=true",
"--jwt-secret=" + package_io.JWT_AUTH_PATH,
"--jwt-secret=" + constants.JWT_AUTH_PATH,
# vvvvvvvvvvvvvvvvvvv METRICS CONFIG vvvvvvvvvvvvvvvvvvvvv
"--metrics",
"--metrics.address=0.0.0.0",
Expand All @@ -265,7 +265,7 @@ def get_beacon_config(
cmd.append(
"--bootnodes="
+ ",".join(
[ctx.enr for ctx in bootnode_contexts[: package_io.MAX_ENR_ENTRIES]]
[ctx.enr for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]]
)
)

Expand All @@ -278,7 +278,7 @@ def get_beacon_config(
ports=BEACON_USED_PORTS,
cmd=cmd,
files={
package_io.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
},
private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER,
ready_conditions=cl_node_ready_conditions.get_ready_conditions(HTTP_PORT_ID),
Expand Down Expand Up @@ -321,12 +321,12 @@ def get_validator_config(
"--logLevel=" + log_level,
"--dataDir=" + root_dirpath,
"--paramsFile="
+ package_io.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/config.yaml",
"--beaconNodes=" + beacon_client_http_url,
"--keystoresDir=" + validator_keys_dirpath,
"--secretsDir=" + validator_secrets_dirpath,
"--suggestedFeeRecipient=" + package_io.VALIDATING_REWARDS_ACCOUNT,
"--suggestedFeeRecipient=" + constants.VALIDATING_REWARDS_ACCOUNT,
# vvvvvvvvvvvvvvvvvvv PROMETHEUS CONFIG vvvvvvvvvvvvvvvvvvvvv
"--metrics",
"--metrics.address=0.0.0.0",
Expand All @@ -343,7 +343,7 @@ def get_validator_config(
ports=VALIDATOR_USED_PORTS,
cmd=cmd,
files={
package_io.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,
VALIDATOR_KEYS_MOUNT_DIRPATH_ON_SERVICE_CONTAINER: node_keystore_files.files_artifact_uuid,
},
private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER,
Expand Down
Loading

0 comments on commit 9bf9979

Please sign in to comment.