Commit fcdc0291 authored by Gyanendra Mishra's avatar Gyanendra Mishra

light house tested

parent e3307078
...@@ -30,7 +30,7 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https: ...@@ -30,7 +30,7 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https:
- [x] remove services post generation - [x] remove services post generation
- [ ] participant_network/el (requires facts and waits) - [ ] participant_network/el (requires facts and waits)
- [ ] besu - [ ] besu
- [ ] facts and waits + private_ip_address_placeholder - [x] facts and waits + private_ip_address_placeholder
- [x] framework - [x] framework
- [ ] erigon - [ ] erigon
- [ ] facts and waits + private_ip_address_placeholder - [ ] facts and waits + private_ip_address_placeholder
...@@ -47,8 +47,8 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https: ...@@ -47,8 +47,8 @@ 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 DEMO - [x] lighthouse DEMO
- [ ] facts and waits - [x] facts and waits
- [x] framework TESTED - [x] framework TESTED
- [ ] loadstar - [ ] loadstar
- [ ] facts and waits - [ ] facts and waits
...@@ -67,4 +67,5 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https: ...@@ -67,4 +67,5 @@ This is the Startosis version of the popular [eth2-merge-kurtosis-module](https:
- [x] cl_availability_waiter - facts and waits - DESCOPED facts and waits will do this - [x] cl_availability_waiter - facts and waits - DESCOPED facts and waits will do this
- [x] cl_rest_client/api_response_objects.go DESCOPED as facts will do this - [x] cl_rest_client/api_response_objects.go DESCOPED as facts will do this
- [x] cl_rest_client/el_rest_client - DESCOPED as facts will do this - [x] cl_rest_client/el_rest_client - DESCOPED as facts will do this
- [x] cl_node_metrics_info - pure POJO NO BLOCKERS - [x] cl_node_metrics_info - pure POJO NO BLOCKERS
\ No newline at end of file - [ ] get render templates to have the magic strings subsituted with real values
\ No newline at end of file
...@@ -55,7 +55,7 @@ def parse_input(input_args): ...@@ -55,7 +55,7 @@ def parse_input(input_args):
participant_value[sub_attr] = get_value_or_name(sub_value) participant_value[sub_attr] = get_value_or_name(sub_value)
# if not we grab the value from the default value dictionary # if not we grab the value from the default value dictionary
elif sub_attr not in (DESCRIPTOR_ATTR_NAME): elif sub_attr not in (DESCRIPTOR_ATTR_NAME):
participant_value[attr] = default_input["participants"][0].get(sub_attr, "") participant_value[sub_attr] = default_input["participants"][0].get(sub_attr, None)
participants.append(participant_value) participants.append(participant_value)
result["participants"] = participants result["participants"] = participants
...@@ -105,7 +105,7 @@ def parse_input(input_args): ...@@ -105,7 +105,7 @@ def parse_input(input_args):
required_num_validtors = 2 * result["network_params"]["slots_per_epoch"] required_num_validtors = 2 * result["network_params"]["slots_per_epoch"]
actual_num_validators = len(result["participants"]) * result["network_params"]["num_validators_per_keynode"] actual_num_validators = len(result["participants"]) * result["network_params"]["num_validators_per_keynode"]
if required_num_validtors < actual_num_validators: if required_num_validtors > actual_num_validators:
fail("required_num_validtors - {0} is greater than actual_num_validators - {1}".format(required_num_validtors, actual_num_validators)) fail("required_num_validtors - {0} is greater than actual_num_validators - {1}".format(required_num_validtors, actual_num_validators))
# Remove if nethermind doesn't break as second node we already test above if its the first node # Remove if nethermind doesn't break as second node we already test above if its the first node
...@@ -163,6 +163,10 @@ def default_partitcipants(): ...@@ -163,6 +163,10 @@ def default_partitcipants():
"el_client_log_level": "", "el_client_log_level": "",
"cl_client_type": "lighthouse", "cl_client_type": "lighthouse",
"cl_client_image": "", "cl_client_image": "",
"cl_client_log_level": "" "cl_client_log_level": "",
"beacon_extra_params": [],
"el_extra_params": [],
"validator_extra_params": [],
"builder_network_params": None
} }
return [participant] return [participant]
...@@ -72,6 +72,9 @@ LIGHTHOUSE_LOG_LEVELS = { ...@@ -72,6 +72,9 @@ LIGHTHOUSE_LOG_LEVELS = {
module_io.GlobalClientLogLevel.trace: "trace", module_io.GlobalClientLogLevel.trace: "trace",
} }
BEACON_ENR_FACT_NAME = "beacon-enr-fact"
BEACON_HEALTH_FACT_NAME = "beacon-health-fact"
def launch( def launch(
launcher, launcher,
service_id, service_id,
...@@ -103,9 +106,12 @@ def launch( ...@@ -103,9 +106,12 @@ def launch(
beacon_service = add_service(beacon_node_service_id, beacon_service_config) beacon_service = add_service(beacon_node_service_id, beacon_service_config)
beacon_http_port = beacon_service.ports[BEACON_HTTP_PORT_ID] # TODO the Golang code checks whether its 200, 206 or 503, maybe add that
# TODO this fact might start breaking if the endpoint requires a leading slash, currently breaks with a leading slash
define_fact(service_id = beacon_node_service_id, fact_name = BEACON_HEALTH_FACT_NAME, fact_recipe = struct(method= "GET", endpoint = "eth/v1/node/health", content_type = "application/json", port_id = BEACON_HTTP_PORT_ID))
wait(service_id = beacon_node_service_id, fact_name = BEACON_HEALTH_FACT_NAME)
# TODO add facts & waits beacon_http_port = beacon_service.ports[BEACON_HTTP_PORT_ID]
# Launch validator node # Launch validator node
beacon_http_url = "http://{0}:{1}".format(beacon_service.ip_address, beacon_http_port.number) beacon_http_url = "http://{0}:{1}".format(beacon_service.ip_address, beacon_http_port.number)
...@@ -123,9 +129,9 @@ def launch( ...@@ -123,9 +129,9 @@ def launch(
validator_service = add_service(validator_node_service_id, validator_service_config) validator_service = add_service(validator_node_service_id, validator_service_config)
# TODO add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module # TODO add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module
# TODO this fact might start breaking if the endpoint requires a leading slash, currently breaks with a leading slash
# TODO get node identity using facts and waits define_fact(service_id = beacon_node_service_id, fact_name = BEACON_ENR_FACT_NAME, fact_recipe = struct(method= "GET", endpoint = "eth/v1/node/identity", field_extractor = ".data.enr", content_type = "application/json", port_id = BEACON_HTTP_PORT_ID))
beacon_node_enr = "" beacon_node_enr = wait(service_id = beacon_node_service_id, fact_name = BEACON_ENR_FACT_NAME)
beacon_metrics_port = beacon_service.ports[BEACON_METRICS_PORT_ID] beacon_metrics_port = beacon_service.ports[BEACON_METRICS_PORT_ID]
beacon_metrics_url = "{0}:{1}".format(beacon_service.ip_address, beacon_metrics_port.number) beacon_metrics_url = "{0}:{1}".format(beacon_service.ip_address, beacon_metrics_port.number)
...@@ -209,7 +215,7 @@ def get_beacon_service_config( ...@@ -209,7 +215,7 @@ def get_beacon_service_config(
] ]
if boot_cl_client_ctx != None: if boot_cl_client_ctx != None:
cmd_args.append("--boot-nodes="+boot_cl_client_ctx.enode) cmd_args.append("--boot-nodes="+boot_cl_client_ctx.enr)
if mev_boost_context != None: if mev_boost_context != None:
cmd_args.append("--builder") cmd_args.append("--builder")
......
...@@ -39,7 +39,7 @@ USED_PORTS = { ...@@ -39,7 +39,7 @@ USED_PORTS = {
WS_PORT_ID: new_port_spec(WS_PORT_NUM, TCP_PROTOCOL), WS_PORT_ID: new_port_spec(WS_PORT_NUM, TCP_PROTOCOL),
TCP_DISCOVERY_PORT_ID: new_port_spec(DISCOVERY_PORT_NUM, TCP_PROTOCOL), TCP_DISCOVERY_PORT_ID: new_port_spec(DISCOVERY_PORT_NUM, TCP_PROTOCOL),
UDP_DISCOVERY_PORT_ID: new_port_spec(DISCOVERY_PORT_NUM, UDP_PROTOCOL), UDP_DISCOVERY_PORT_ID: new_port_spec(DISCOVERY_PORT_NUM, UDP_PROTOCOL),
ENGINE_HTTP_RPC_PORT_ID: new_port_spec(ENGINE_HTTP_RPC_PORT_NUM, TCP_PROTOCOL) ENGINE_HTTP_RPC_PORT_ID: new_port_spec(ENGINE_HTTP_RPC_PORT_NUM, TCP_PROTOCOL),
ENGINE_WS_RPC_PORT_ID: new_port_spec(ENGINE_WS_RPC_PORT_NUM, TCP_PROTOCOL) ENGINE_WS_RPC_PORT_ID: new_port_spec(ENGINE_WS_RPC_PORT_NUM, TCP_PROTOCOL)
} }
...@@ -53,7 +53,7 @@ BESU_LOG_LEVELS = { ...@@ -53,7 +53,7 @@ BESU_LOG_LEVELS = {
module_io.GlobalClientLogLevel.trace: "TRACE", module_io.GlobalClientLogLevel.trace: "TRACE",
} }
ENODE_FACT_NAME = "enode-fact"
def launch( def launch(
launcher, launcher,
...@@ -71,7 +71,9 @@ def launch( ...@@ -71,7 +71,9 @@ def launch(
service = add_service(service_id, service_config) service = add_service(service_id, service_config)
# TODO add facts & waits # TODO this fact might start breaking if the endpoint requires a leading slash, currently breaks with a leading slash
define_fact(service_id = service_id, fact_name = ENODE_FACT_NAME, fact_recipe = struct(method= "POST", endpoint = "", field_extractor = ".result.enode", body = '{"method":"admin_nodeInfo","params":[],"id":1,"jsonrpc":"2.0"}', content_type = "application/json", port_id = RPC_PORT_ID))
enode = wait(service_id = service_id, fact_name = ENODE_FACT_NAME)
return new_el_client_context( return new_el_client_context(
"besu", "besu",
...@@ -111,7 +113,7 @@ def get_service_config(network_id, genesis_data, image, existing_el_clients, log ...@@ -111,7 +113,7 @@ def get_service_config(network_id, genesis_data, image, existing_el_clients, log
"--rpc-ws-port={0}".format(WS_PORT_NUM), "--rpc-ws-port={0}".format(WS_PORT_NUM),
"--rpc-ws-api=ADMIN,CLIQUE,ETH,NET,DEBUG,TXPOOL,ENGINE", "--rpc-ws-api=ADMIN,CLIQUE,ETH,NET,DEBUG,TXPOOL,ENGINE",
"--p2p-enabled=true", "--p2p-enabled=true",
"--p2p-host=" + PRIVATE_IP_ADDRESS_PLACEHOLDER "--p2p-host=" + PRIVATE_IP_ADDRESS_PLACEHOLDER,
"--p2p-port={0}".format(DISCOVERY_PORT_NUM), "--p2p-port={0}".format(DISCOVERY_PORT_NUM),
"--engine-rpc-enabled=true", "--engine-rpc-enabled=true",
"--engine-jwt-secret={0}".format(jwt_secret_json_filepath_on_client), "--engine-jwt-secret={0}".format(jwt_secret_json_filepath_on_client),
...@@ -125,8 +127,6 @@ def get_service_config(network_id, genesis_data, image, existing_el_clients, log ...@@ -125,8 +127,6 @@ def get_service_config(network_id, genesis_data, image, existing_el_clients, log
if len(extra_params) > 0: if len(extra_params) > 0:
launch_node_command.extend(extra_params) launch_node_command.extend(extra_params)
# doing this as the eth2 module does this
# TODO potentially remove this and just pass the launch_node_command
launch_node_command_str = " ".join(launch_node_command) launch_node_command_str = " ".join(launch_node_command)
return struct( return struct(
...@@ -137,9 +137,7 @@ def get_service_config(network_id, genesis_data, image, existing_el_clients, log ...@@ -137,9 +137,7 @@ def get_service_config(network_id, genesis_data, image, existing_el_clients, log
genesis_data.files_artifact_uuid: GENESIS_DATA_DIRPATH_ON_CLIENT_CONTAINER genesis_data.files_artifact_uuid: GENESIS_DATA_DIRPATH_ON_CLIENT_CONTAINER
}, },
entry_point_args = ENTRYPOINT_ARGS, entry_point_args = ENTRYPOINT_ARGS,
# TODO add private IP address place holder when add servicde supports it privaite_ip_address_placeholder = PRIVATE_IP_ADDRESS_PLACEHOLDER
# for now this will work as we use the service config default above
# https://github.com/kurtosis-tech/kurtosis/pull/290
) )
......
...@@ -52,6 +52,9 @@ ERIGON_LOG_LEVELS = { ...@@ -52,6 +52,9 @@ ERIGON_LOG_LEVELS = {
module_io.GlobalClientLogLevel.trace: "5", module_io.GlobalClientLogLevel.trace: "5",
} }
ENR_FACT_NAME = "enr-fact"
ENODE_FACT_NAME = "enode-fact"
def launch( def launch(
launcher, launcher,
service_id, service_id,
...@@ -68,7 +71,13 @@ def launch( ...@@ -68,7 +71,13 @@ def launch(
service = add_service(service_id, service_config) service = add_service(service_id, service_config)
# TODO add facts & waits # TODO this fact might start breaking if the endpoint requires a leading slash, currently breaks with a leading slash
define_fact(service_id = service_id, fact_name = ENR_FACT_NAME, fact_recipe = struct(method= "POST", endpoint = "", field_extractor = ".result.enr", body = '{"method":"admin_nodeInfo","params":[],"id":1,"jsonrpc":"2.0"}', content_type = "application/json", port_id = RPC_PORT_ID))
enr = wait(service_id = service_id, fact_name = ENR_FACT_NAME)
# TODO this fact might start breaking if the endpoint requires a leading slash, currently breaks with a leading slash
define_fact(service_id = service_id, fact_name = ENODE_FACT_NAME, fact_recipe = struct(method= "POST", endpoint = "", field_extractor = ".result.enode", body = '{"method":"admin_nodeInfo","params":[],"id":1,"jsonrpc":"2.0"}', content_type = "application/json", port_id = RPC_PORT_ID))
enode = wait(service_id = service_id, fact_name = ENODE_FACT_NAME)
return new_el_client_context( return new_el_client_context(
"erigon", "erigon",
...@@ -92,7 +101,7 @@ def get_service_config(network_id, genesis_data, image, existing_el_clients, ver ...@@ -92,7 +101,7 @@ def get_service_config(network_id, genesis_data, image, existing_el_clients, ver
genesis_json_filepath_on_client, genesis_json_filepath_on_client,
) )
# TODO remove this based on https://github.com/kurtosis-tech/eth2-merge-kurtosis-module/issues/152
if len(existing_el_clients) == 0: if len(existing_el_clients) == 0:
fail("Erigon needs at least one node to exist, which it treats as the bootnode") fail("Erigon needs at least one node to exist, which it treats as the bootnode")
...@@ -137,9 +146,7 @@ def get_service_config(network_id, genesis_data, image, existing_el_clients, ver ...@@ -137,9 +146,7 @@ def get_service_config(network_id, genesis_data, image, existing_el_clients, ver
genesis_data.files_artifact_uuid: GENESIS_DATA_MOUNT_DIRPATH genesis_data.files_artifact_uuid: GENESIS_DATA_MOUNT_DIRPATH
}, },
entry_point_args = ENTRYPOINT_ARGS, entry_point_args = ENTRYPOINT_ARGS,
# TODO add private IP address place holder when add servicde supports it privaite_ip_address_placeholder = PRIVATE_IP_ADDRESS_PLACEHOLDER
# for now this will work as we use the service config default above
# https://github.com/kurtosis-tech/kurtosis/pull/290
) )
......
...@@ -83,9 +83,11 @@ def launch( ...@@ -83,9 +83,11 @@ def launch(
service = add_service(service_id, service_config) service = add_service(service_id, service_config)
# TODO this fact might start breaking if the endpoint requires a leading slash, currently breaks with a leading slash
define_fact(service_id = service_id, fact_name = ENR_FACT_NAME, fact_recipe = struct(method= "POST", endpoint = "", field_extractor = ".result.enr", body = '{"method":"admin_nodeInfo","params":[],"id":1,"jsonrpc":"2.0"}', content_type = "application/json", port_id = RPC_PORT_ID)) define_fact(service_id = service_id, fact_name = ENR_FACT_NAME, fact_recipe = struct(method= "POST", endpoint = "", field_extractor = ".result.enr", body = '{"method":"admin_nodeInfo","params":[],"id":1,"jsonrpc":"2.0"}', content_type = "application/json", port_id = RPC_PORT_ID))
enr = wait(service_id = service_id, fact_name = ENR_FACT_NAME) enr = wait(service_id = service_id, fact_name = ENR_FACT_NAME)
# TODO this fact might start breaking if the endpoint requires a leading slash, currently breaks with a leading slash
define_fact(service_id = service_id, fact_name = ENODE_FACT_NAME, fact_recipe = struct(method= "POST", endpoint = "", field_extractor = ".result.enode", body = '{"method":"admin_nodeInfo","params":[],"id":1,"jsonrpc":"2.0"}', content_type = "application/json", port_id = RPC_PORT_ID)) define_fact(service_id = service_id, fact_name = ENODE_FACT_NAME, fact_recipe = struct(method= "POST", endpoint = "", field_extractor = ".result.enode", body = '{"method":"admin_nodeInfo","params":[],"id":1,"jsonrpc":"2.0"}', content_type = "application/json", port_id = RPC_PORT_ID))
enode = wait(service_id = service_id, fact_name = ENODE_FACT_NAME) enode = wait(service_id = service_id, fact_name = ENODE_FACT_NAME)
......
...@@ -8,6 +8,10 @@ load("github.com/kurtosis-tech/eth2-module/src/participant_network/mev_boost/mev ...@@ -8,6 +8,10 @@ load("github.com/kurtosis-tech/eth2-module/src/participant_network/mev_boost/mev
load("github.com/kurtosis-tech/eth2-module/src/static_files/static_files.star", "GETH_PREFUNDED_KEYS_DIRPATH", "EL_GENESIS_GENERATION_CONFIG_TEMPLATE_FILEPATH", "CL_GENESIS_GENERATION_CONFIG_TEMPLATE_FILEPATH", "CL_GENESIS_GENERATION_MNEMONICS_TEMPLATE_FILEPATH") load("github.com/kurtosis-tech/eth2-module/src/static_files/static_files.star", "GETH_PREFUNDED_KEYS_DIRPATH", "EL_GENESIS_GENERATION_CONFIG_TEMPLATE_FILEPATH", "CL_GENESIS_GENERATION_CONFIG_TEMPLATE_FILEPATH", "CL_GENESIS_GENERATION_MNEMONICS_TEMPLATE_FILEPATH")
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/el/geth/geth_launcher.star", launch_geth="launch", "new_geth_launcher")
load("github.com/kurtosis-tech/eth2-module/src/participant_network/el/besu/besu_launcher.star", launch_besu="launch", "new_besu_launcher")
load("github.com/kurtosis-tech/eth2-module/src/participant_network/el/erigon/erigon_launcher.star", launch_erigon="launch", "new_erigon_launcher")
load("github.com/kurtosis-tech/eth2-module/src/participant_network/cl/lighthouse/lighthouse_launcher.star", launch_lighthouse="launch", "new_lighthouse_launcher") load("github.com/kurtosis-tech/eth2-module/src/participant_network/cl/lighthouse/lighthouse_launcher.star", launch_lighthouse="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") load("github.com/kurtosis-tech/eth2-module/src/participant_network/prelaunch_data_generator/genesis_constants/genesis_constants.star", "PRE_FUNDED_ACCOUNTS")
...@@ -71,7 +75,9 @@ def launch_participant_network(participants, network_params, global_log_level): ...@@ -71,7 +75,9 @@ def launch_participant_network(participants, network_params, global_log_level):
el_launchers = { el_launchers = {
# TODO Allow for other types here # TODO Allow for other types here
module_io.ELClientType.geth : {"launcher": new_geth_launcher(network_params.network_id, el_genesis_data, geth_prefunded_keys_artifact_id, PRE_FUNDED_ACCOUNTS), "launch_method": launch_geth} module_io.ELClientType.geth : {"launcher": new_geth_launcher(network_params.network_id, el_genesis_data, geth_prefunded_keys_artifact_id, PRE_FUNDED_ACCOUNTS), "launch_method": launch_geth},
module_io.ELClientType.besu : {"launcher": new_besu_launcher(network_params.network_id, el_genesis_data), "launch_method": launch_besu},
module_io.ELClientType.erigon : {"launcher": new_erigon_launcher(network_params.network_id, el_genesis_data), "launch_method": launch_erigon},
} }
all_el_client_contexts = [] all_el_client_contexts = []
......
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