Commit 3e6e2631 authored by Gyanendra Mishra's avatar Gyanendra Mishra

this seems cleaner

parent 35f5928e
...@@ -14,7 +14,7 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https: ...@@ -14,7 +14,7 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https:
- [x] static_files package - [x] static_files package
- [x] testnet_verifier (this is blocked on CL/EL clients running) - [x] testnet_verifier (this is blocked on CL/EL clients running)
- [x] transaction_spammer (this is blocked on EL clients running) - [x] transaction_spammer (this is blocked on EL clients running)
- [ ] participant_network/participant_network - [ ] participant_network/participant_network DEMO
- [ ] has most data generation things, needs to start EL/CL clients - [ ] has most data generation things, needs to start EL/CL clients
- [x] needs upload files to be implemented - [x] needs upload files to be implemented
- [x] participant_network/participant - [x] participant_network/participant
...@@ -32,7 +32,7 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https: ...@@ -32,7 +32,7 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https:
- [ ] erigon - [ ] erigon
- [ ] facts and waits + private_ip_address_placeholder - [ ] facts and waits + private_ip_address_placeholder
- [x] framework - [x] framework
- [ ] geth - [ ] geth DEMO
- [ ] facts and waits + private_ip_address_placeholder - [ ] facts and waits + private_ip_address_placeholder
- [x] framework - [x] framework
- [ ] nethermind - [ ] nethermind
...@@ -44,7 +44,7 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https: ...@@ -44,7 +44,7 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https:
- [x] el_rest_client/api_response_objects.go DESCOPED as facts will do this - [x] el_rest_client/api_response_objects.go DESCOPED as facts will do this
- [x] el_rest_client/el_rest_client - facts and waits DESCOPED as facts will do this - [x] el_rest_client/el_rest_client - facts and waits DESCOPED as facts will do this
- [ ] participant_network/cl (requires facts and waits) - [ ] participant_network/cl (requires facts and waits)
- [ ] lighthouse - [ ] lighthouse DEMO
- [ ] facts and waits - [ ] facts and waits
- [x] framework - [x] framework
- [ ] loadstar - [ ] loadstar
......
...@@ -7,7 +7,7 @@ def main(input_args): ...@@ -7,7 +7,7 @@ def main(input_args):
input_args_with_right_defaults = module_io.ModuleInput(parse_input(input_args)) input_args_with_right_defaults = module_io.ModuleInput(parse_input(input_args))
num_participants = len(input_args_with_right_defaults.participants) num_participants = len(input_args_with_right_defaults.participants)
print("Launching participant network with {0} participants and the following network params {1}".format(num_participants, input_args_with_right_defaults.network_params)) print("Launching participant network with {0} participants and the following network params {1}".format(num_participants, input_args_with_right_defaults.network_params))
launch_participant_network(num_participants, input_args_with_right_defaults.network_params) launch_participant_network(input_args_with_right_defaults.participants, input_args_with_right_defaults.network_params, input_args_with_right_defaults.global_log_level)
#TODO replace with actual values #TODO replace with actual values
grafana_info = module_io.GrafanaInfo( grafana_info = module_io.GrafanaInfo(
dashboard_path = "dummy_path", dashboard_path = "dummy_path",
......
...@@ -5,11 +5,41 @@ load("github.com/kurtosis-tech/eth2-module/src/participant_network/prelaunch_dat ...@@ -5,11 +5,41 @@ load("github.com/kurtosis-tech/eth2-module/src/participant_network/prelaunch_dat
load("github.com/kurtosis-tech/eth2-module/src/participant_network/mev_boost/mev_boost_context.star", "mev_boost_endpoint") load("github.com/kurtosis-tech/eth2-module/src/participant_network/mev_boost/mev_boost_context.star", "mev_boost_endpoint")
load("github.com/kurtosis-tech/eth2-module/src/participant_network/mev_boost/mev_boost_launcher.star", launch_mevboost="launch", "new_mev_boost_launcher") load("github.com/kurtosis-tech/eth2-module/src/participant_network/mev_boost/mev_boost_launcher.star", launch_mevboost="launch", "new_mev_boost_launcher")
load("github.com/kurtosis-tech/eth2-module/src/static_files/static_files.star", "GETH_PREFUNDED_KEYS_DIRPATH")
load("github.com/kurtosis-tech/eth2-module/src/participant_network/el/geth/geth_launcher.star", launch_geth="launch", "new_geth_launcher")
load("github.com/kurtosis-tech/eth2-module/src/participant_network/cl/lighthouse/lighthouse_launcher.star", lighthouse_launcher="launch", "new_lighthouse_launcher")
load("github.com/kurtosis-tech/eth2-module/src/participant_network/prelaunch_data_generator/genesis_constants/genesis_constants.star", "PRE_FUNDED_ACCOUNTS")
module_io = import_types("github.com/kurtosis-tech/eth2-module/types.proto")
CL_CLIENT_SERVICE_ID_PREFIX = "cl-client-"
EL_CLIENT_SERVICE_ID_PREFIX = "el-client-"
MEV_BOOST_SERVICE_ID_PREFIX = "mev-boost-"
BOOT_PARTICIPANT_INDEX = 0
# The time that the CL genesis generation step takes to complete, based off what we've seen
CL_GENESIS_DATA_GENERATION_TIME = 2 * time.minute
# Each CL node takes about this time to start up and start processing blocks, so when we create the CL
# genesis data we need to set the genesis timestamp in the future so that nodes don't miss important slots
# (e.g. Altair fork)
# TODO Make this client-specific (currently this is Nimbus)
CL_NODE_STARTUP_TIME = 45 * time.second
MEV_BOOST_SERVICE_ID_PREFIX = "mev-boost-" MEV_BOOST_SERVICE_ID_PREFIX = "mev-boost-"
MEV_BOOST_SHOULD_RELAY = True MEV_BOOST_SHOULD_RELAY = True
def launch_participant_network(num_participants, network_params): CL_CLIENT_CONTEXT_BOOTNODE = None
def launch_participant_network(participants, network_params, global_log_level):
num_participants = len(participants)
genesis_timestamp = time.now().unix
print("Generating cl validator key stores") print("Generating cl validator key stores")
keystore_result = generate_cl_validator_keystores( keystore_result = generate_cl_validator_keystores(
...@@ -21,8 +51,6 @@ def launch_participant_network(num_participants, network_params): ...@@ -21,8 +51,6 @@ def launch_participant_network(num_participants, network_params):
print(json.indent(json.encode(keystore_result))) print(json.indent(json.encode(keystore_result)))
genesis_timestamp = time.now().unix
print("Generating EL data") print("Generating EL data")
el_genesis_generation_config_template = read_file("github.com/kurtosis-tech/eth2-module/static_files/genesis-generation-config/el/genesis-config.yaml.tmpl") el_genesis_generation_config_template = read_file("github.com/kurtosis-tech/eth2-module/static_files/genesis-generation-config/el/genesis-config.yaml.tmpl")
el_genesis_data = generate_el_genesis_data( el_genesis_data = generate_el_genesis_data(
...@@ -35,6 +63,35 @@ def launch_participant_network(num_participants, network_params): ...@@ -35,6 +63,35 @@ def launch_participant_network(num_participants, network_params):
print(json.indent(json.encode(el_genesis_data))) print(json.indent(json.encode(el_genesis_data)))
print("Uploading GETH prefunded keys")
geth_prefunded_keys_artifact_id = upload_files(GETH_PREFUNDED_KEYS_DIRPATH)
print("Uploaded GETH files succesfully")
el_launchers = {
# TODO Allow for other types here
module_io.ELClientType.geth : {"launcher": new_geth_launcher(el_genesis_data, geth_prefunded_keys_artifact_id, PRE_FUNDED_ACCOUNTS, network_params.network_id), "launch_method": launch_geth}
}
all_el_client_contexts = []
for index, participant in enumerate(participants):
el_client_type = participant.el_client_type
if el_client_type not in el_launchers:
fail("Unsupported launcher '{0}', need one of '{1}'".format(el_client_type, ",".join(el_launchers.keys())))
el_launcher, launch_method = el_launchers[el_client_type]["launcher"], el_launchers[el_client_type]["launch_method"]
el_service_id = "{0}{1}".format(EL_CLIENT_SERVICE_ID_PREFIX, index)
el_client_context = launch_method(el_launcher, el_service_id, participant.el_client_image, participant.el_client_log_level, global_log_level, all_el_client_contexts, participant.el_extra_params)
all_el_client_contexts.append(el_client_context)
print("Succesfully added {0} EL participants".format(num_participants))
print("Generating CL data") print("Generating CL data")
genesis_generation_config_yml_template = read_file("github.com/kurtosis-tech/eth2-module/static_files/genesis-generation-config/cl/config.yaml.tmpl") genesis_generation_config_yml_template = read_file("github.com/kurtosis-tech/eth2-module/static_files/genesis-generation-config/cl/config.yaml.tmpl")
genesis_generation_mnemonics_yml_template = read_file("github.com/kurtosis-tech/eth2-module/static_files/genesis-generation-config/cl/mnemonics.yaml.tmpl") genesis_generation_mnemonics_yml_template = read_file("github.com/kurtosis-tech/eth2-module/static_files/genesis-generation-config/cl/mnemonics.yaml.tmpl")
......
...@@ -22,3 +22,12 @@ def path_dir(path): ...@@ -22,3 +22,12 @@ def path_dir(path):
def new_port_spec(number, protocol): def new_port_spec(number, protocol):
return struct(number = number, protocol = protocol) return struct(number = number, protocol = protocol)
def wait_for(duration):
now = time.now().unix
later = now + duration
while now < later:
now = time.now().unix
continue
return
# The path on the module container where static files are housed # The path on the module container where static files are housed
STATIC_FILES_DIRPATH = "/static-files" STATIC_FILES_DIRPATH = "github.com/kurtosis-tech/eth2-module/static_files"
# Geth + CL genesis generation # Geth + CL genesis generation
GENESIS_GENERATION_CONFIG_DIRPATH = STATIC_FILES_DIRPATH + "/genesis-generation-config" GENESIS_GENERATION_CONFIG_DIRPATH = STATIC_FILES_DIRPATH + "/genesis-generation-config"
EL_GENESIS_GENERATION_CONFIG_DIRPATH = GENESIS_GENERATION_CONFIG_DIRPATH + "/el" EL_GENESIS_GENERATION_CONFIG_DIRPATH = GENESIS_GENERATION_CONFIG_DIRPATH + "/el"
E_L_GENESIS_GENERATION_CONFIG_TEMPLATE_FILEPATH = EL_GENESIS_GENERATION_CONFIG_DIRPATH + \ EL_GENESIS_GENERATION_CONFIG_TEMPLATE_FILEPATH = EL_GENESIS_GENERATION_CONFIG_DIRPATH + \
"/genesis-config.yaml.tmpl" "/genesis-config.yaml.tmpl"
CL_GENESIS_GENERATION_CONFIG_DIRPATH = GENESIS_GENERATION_CONFIG_DIRPATH + "/cl" CL_GENESIS_GENERATION_CONFIG_DIRPATH = GENESIS_GENERATION_CONFIG_DIRPATH + "/cl"
C_L_GENESIS_GENERATION_CONFIG_TEMPLATE_FILEPATH = CL_GENESIS_GENERATION_CONFIG_DIRPATH + \ CL_GENESIS_GENERATION_CONFIG_TEMPLATE_FILEPATH = CL_GENESIS_GENERATION_CONFIG_DIRPATH + \
"/config.yaml.tmpl" "/config.yaml.tmpl"
C_L_GENESIS_GENERATION_MNEMONICS_TEMPLATE_FILEPATH = CL_GENESIS_GENERATION_CONFIG_DIRPATH + \ CL_GENESIS_GENERATION_MNEMONICS_TEMPLATE_FILEPATH = CL_GENESIS_GENERATION_CONFIG_DIRPATH + \
"/mnemonics.yaml.tmpl" "/mnemonics.yaml.tmpl"
# Prefunded keys # Prefunded keys
......
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