Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
feat: added 'participant.el_extra_env_vars' config param (#128)
Browse files Browse the repository at this point in the history
fix #126
  • Loading branch information
leoporoli committed Sep 20, 2023
1 parent d843d7c commit b6ed50f
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 36 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,18 @@ For example, this `eth-network-params.json` adds a second node, running a differ

```json
{
"//note": "each participant struct in particpants corresponds to a node in the network",
"//note": "each participant struct in participants corresponds to a node in the network",
"participants": [
{
"el_client_type": "geth",
"el_client_image": "",
"el_client_log_level": "",
"el_extra_params": [],
"el_extra_env_vars": {},
"cl_client_type": "lighthouse",
"cl_client_image": "",
"cl_client_log_level": "",
"beacon_extra_params": [],
"el_extra_params": [],
"validator_extra_params": [],
"builder_network_params": null,
"count": 1
Expand All @@ -176,11 +177,12 @@ For example, this `eth-network-params.json` adds a second node, running a differ
"el_client_type": "nethermind",
"el_client_image": "",
"el_client_log_level": "",
"el_extra_params": [],
"el_extra_env_vars": {},
"cl_client_type": "teku",
"cl_client_image": "",
"cl_client_log_level": "",
"beacon_extra_params": [],
"el_extra_params": [],
"validator_extra_params": [],
"builder_network_params": null,
"count": 1
Expand Down
3 changes: 2 additions & 1 deletion default-network-params.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"el_client_type": "geth",
"el_client_image": "",
"el_client_log_level": "",
"el_extra_params": [],
"el_extra_env_vars": {},
"cl_client_type": "lighthouse",
"cl_client_image": "",
"cl_client_log_level": "",
"beacon_extra_params": [],
"el_extra_params": [],
"validator_extra_params": [],
"builder_network_params": null,
"count": 1
Expand Down
2 changes: 2 additions & 0 deletions package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def get_args_with_default_values(args):
cl_client_log_level=participant["cl_client_log_level"],
beacon_extra_params=participant["beacon_extra_params"],
el_extra_params=participant["el_extra_params"],
el_extra_env_vars=participant["el_extra_env_vars"],
validator_extra_params=participant["validator_extra_params"],
builder_network_params=participant["builder_network_params"],
el_min_cpu=participant["el_min_cpu"],
Expand Down Expand Up @@ -223,6 +224,7 @@ def default_participant():
"cl_client_log_level": "",
"beacon_extra_params": [],
"el_extra_params": [],
"el_extra_env_vars": {},
"validator_extra_params": [],
"builder_network_params": None,
"el_min_cpu": 0,
Expand Down
12 changes: 8 additions & 4 deletions src/el/besu/besu_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def launch(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params):
extra_params,
extra_env_vars):

log_level = input_parser.get_client_log_level_or_default(participant_log_level, global_log_level, BESU_LOG_LEVELS)

Expand All @@ -79,7 +80,8 @@ def launch(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params
extra_params,
extra_env_vars
)

service = plan.add_service(service_name, config)
Expand Down Expand Up @@ -111,7 +113,8 @@ def get_config(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params):
extra_params,
extra_env_vars):

genesis_json_filepath_on_client = shared_utils.path_join(GENESIS_DATA_DIRPATH_ON_CLIENT_CONTAINER, genesis_data.besu_genesis_json_relative_filepath)
jwt_secret_json_filepath_on_client = shared_utils.path_join(GENESIS_DATA_DIRPATH_ON_CLIENT_CONTAINER, genesis_data.jwt_secret_relative_filepath)
Expand Down Expand Up @@ -165,7 +168,8 @@ def get_config(
min_cpu = el_min_cpu,
max_cpu = el_max_cpu,
min_memory = el_min_mem,
max_memory = el_max_mem
max_memory = el_max_mem,
env_vars = extra_env_vars
), jwt_secret_json_filepath_on_client


Expand Down
12 changes: 8 additions & 4 deletions src/el/erigon/erigon_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def launch(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params):
extra_params,
extra_env_vars):

log_level = input_parser.get_client_log_level_or_default(participant_log_level, global_log_level, ERIGON_LOG_LEVELS)

Expand All @@ -76,7 +77,8 @@ def launch(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params
extra_params,
extra_env_vars
)

service = plan.add_service(service_name, config)
Expand Down Expand Up @@ -108,7 +110,8 @@ def get_config(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params):
extra_params,
extra_env_vars):
network_id = network_id

genesis_json_filepath_on_client = shared_utils.path_join(GENESIS_DATA_MOUNT_DIRPATH, genesis_data.erigon_genesis_json_relative_filepath)
Expand Down Expand Up @@ -174,7 +177,8 @@ def get_config(
min_cpu = el_min_cpu,
max_cpu = el_max_cpu,
min_memory = el_min_mem,
max_memory = el_max_mem
max_memory = el_max_mem,
env_vars = extra_env_vars
), jwt_secret_json_filepath_on_client


Expand Down
12 changes: 8 additions & 4 deletions src/el/ethereumjs/ethereumjs_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def launch(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params):
extra_params,
extra_env_vars):


log_level = input_parser.get_client_log_level_or_default(participant_log_level, global_log_level, VERBOSITY_LEVELS)
Expand All @@ -91,7 +92,8 @@ def launch(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params
extra_params,
extra_env_vars
)

service = plan.add_service(service_name, config)
Expand Down Expand Up @@ -121,7 +123,8 @@ def get_config(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params):
extra_params,
extra_env_vars):

genesis_json_filepath_on_client = shared_utils.path_join(GENESIS_DATA_MOUNT_DIRPATH, genesis_data.geth_genesis_json_relative_filepath)
jwt_secret_json_filepath_on_client = shared_utils.path_join(GENESIS_DATA_MOUNT_DIRPATH, genesis_data.jwt_secret_relative_filepath)
Expand Down Expand Up @@ -169,7 +172,8 @@ def get_config(
min_cpu = el_min_cpu,
max_cpu = el_max_cpu,
min_memory = el_min_mem,
max_memory = el_max_mem
max_memory = el_max_mem,
env_vars = extra_env_vars
), jwt_secret_json_filepath_on_client


Expand Down
16 changes: 5 additions & 11 deletions src/el/geth/geth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def launch(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params):
extra_params,
extra_env_vars):

log_level = input_parser.get_client_log_level_or_default(participant_log_level, global_log_level, VERBOSITY_LEVELS)
el_min_cpu = el_min_cpu if int(el_min_cpu) > 0 else EXECUTION_MIN_CPU
Expand All @@ -97,6 +98,7 @@ def launch(
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
launcher.electra_fork_epoch
)

Expand Down Expand Up @@ -132,6 +134,7 @@ def get_config(
el_min_mem,
el_max_mem,
extra_params,
extra_env_vars,
electra_fork_epoch):

genesis_json_filepath_on_client = shared_utils.path_join(GENESIS_DATA_MOUNT_DIRPATH, genesis_data.geth_genesis_json_relative_filepath)
Expand All @@ -145,15 +148,6 @@ def get_config(
if package_io.GENESIS_VALIDATORS_ROOT_PLACEHOLDER in extra_param:
extra_params[index] = extra_param.replace(package_io.GENESIS_VALIDATORS_ROOT_PLACEHOLDER, genesis_validators_root)

env_vars = {}

# the key here is the private key of the first genesis account
# note that the mev builder is the one that needs this and not other nodes
# TODO productize a way to send custom env variables
if BUILDER_IMAGE_STR in image:
env_vars = {
"BUILDER_TX_SIGNING_KEY": "0x" + genesis_constants.PRE_FUNDED_ACCOUNTS[0].private_key
}

accounts_to_unlock_str = ",".join(account_addresses_to_unlock)

Expand Down Expand Up @@ -241,7 +235,7 @@ def get_config(
max_cpu = el_max_cpu,
min_memory = el_min_mem,
max_memory = el_max_mem,
env_vars = env_vars
env_vars = extra_env_vars
), jwt_secret_json_filepath_on_client


Expand Down
12 changes: 8 additions & 4 deletions src/el/nethermind/nethermind_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def launch(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params):
extra_params,
extra_env_vars):

log_level = input_parser.get_client_log_level_or_default(participant_log_level, global_log_level, NETHERMIND_LOG_LEVELS)

Expand All @@ -77,7 +78,8 @@ def launch(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params
extra_params,
extra_env_vars
)

service = plan.add_service(service_name, config)
Expand Down Expand Up @@ -109,7 +111,8 @@ def get_config(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params):
extra_params,
extra_env_vars):


genesis_json_filepath_on_client = shared_utils.path_join(GENESIS_DATA_MOUNT_DIRPATH, genesis_data.nethermind_genesis_json_relative_filepath)
Expand Down Expand Up @@ -154,7 +157,8 @@ def get_config(
min_cpu = el_min_cpu,
max_cpu = el_max_cpu,
min_memory = el_min_mem,
max_memory = el_max_mem
max_memory = el_max_mem,
env_vars = extra_env_vars
), jwt_secret_json_filepath_on_client


Expand Down
12 changes: 8 additions & 4 deletions src/el/reth/reth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def launch(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params):
extra_params,
extra_env_vars):


log_level = input_parser.get_client_log_level_or_default(participant_log_level, global_log_level, VERBOSITY_LEVELS)
Expand All @@ -88,7 +89,8 @@ def launch(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params
extra_params,
extra_env_vars
)

service = plan.add_service(service_name, config)
Expand Down Expand Up @@ -118,7 +120,8 @@ def get_config(
el_max_cpu,
el_min_mem,
el_max_mem,
extra_params):
extra_params,
extra_env_vars):

genesis_json_filepath_on_client = shared_utils.path_join(GENESIS_DATA_MOUNT_DIRPATH, genesis_data.geth_genesis_json_relative_filepath)
jwt_secret_json_filepath_on_client = shared_utils.path_join(GENESIS_DATA_MOUNT_DIRPATH, genesis_data.jwt_secret_relative_filepath)
Expand Down Expand Up @@ -181,7 +184,8 @@ def get_config(
min_cpu = el_min_cpu,
max_cpu = el_max_cpu,
min_memory = el_min_mem,
max_memory = el_max_mem
max_memory = el_max_mem,
env_vars = extra_env_vars
), jwt_secret_json_filepath_on_client


Expand Down
3 changes: 2 additions & 1 deletion src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ def launch_participant_network(plan, participants, network_params, global_log_le
participant.el_max_cpu,
participant.el_min_mem,
participant.el_max_mem,
participant.el_extra_params
participant.el_extra_params,
participant.el_extra_env_vars
)

all_el_client_contexts.append(el_client_context)
Expand Down

0 comments on commit b6ed50f

Please sign in to comment.