Commit ce8a6285 authored by Victor Colombo's avatar Victor Colombo Committed by GitHub

Merge pull request #38 from kurtosis-tech/vcolombo/refactor-define-fact-wait-request

Refactor code to new support wait and request calls
parents 3ff4c194 21a1638e
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
### Changes ### Changes
- Updated `run(input_args)` to `run(args)` - Updated `run(input_args)` to `run(args)`
- Refactor code to use `wait` and `request` commands
- Removed `print(output)` at the end as it is now printed by the framework - Removed `print(output)` at the end as it is now printed by the framework
- Updates nimbus default docker image - Updates nimbus default docker image
- Updates `genesis-generator` image to include a fix for nimbus post-merge genesis - Updates `genesis-generator` image to include a fix for nimbus post-merge genesis
......
...@@ -77,9 +77,17 @@ def run(args): ...@@ -77,9 +77,17 @@ def run(args):
print("Waiting for the first finalized epoch") print("Waiting for the first finalized epoch")
first_cl_client = all_cl_client_contexts[0] first_cl_client = all_cl_client_contexts[0]
first_cl_client_id = first_cl_client.beacon_service_id first_cl_client_id = first_cl_client.beacon_service_id
define_fact(service_id = first_cl_client_id, fact_name = FIRST_NODE_FINALIZATION_FACT, fact_recipe = struct(method= "GET", endpoint = "/eth/v1/beacon/states/head/finality_checkpoints", content_type = "application/json", port_id = HTTP_PORT_ID_FOR_FACT, field_extractor = ".data.finalized.epoch")) epoch_recipe = struct(
finalized_epoch = wait(service_id = first_cl_client_id, fact_name = FIRST_NODE_FINALIZATION_FACT) service_id = first_cl_client_id,
# TODO make an assertion on the finalized_epoch > 0 method= "GET",
endpoint = "/eth/v1/beacon/states/head/finality_checkpoints",
content_type = "application/json",
port_id = HTTP_PORT_ID_FOR_FACT,
extract = {
"finalized_epoch": ".data.finalized.epoch"
}
)
wait(epoch_recipe, "extract.finalized_epoch", "!=", "0", timeout="40m")
print("First finalized epoch occurred successfully") print("First finalized epoch occurred successfully")
......
def wait_for_healthy(service_id, port_id):
recipe = struct(
service_id = service_id,
method= "GET",
endpoint = "/eth/v1/node/health",
content_type = "application/json",
port_id = port_id
)
return wait(recipe, "code", "IN", [200, 206, 503])
...@@ -3,6 +3,7 @@ parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_i ...@@ -3,6 +3,7 @@ parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_i
cl_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_client_context.star") cl_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_client_context.star")
cl_node_metrics = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_metrics_info.star") cl_node_metrics = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_metrics_info.star")
mev_boost_context_module = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/mev_boost/mev_boost_context.star") mev_boost_context_module = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/mev_boost/mev_boost_context.star")
cl_node_health_checker = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_health_checker.star")
package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star") package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star")
...@@ -64,9 +65,6 @@ LIGHTHOUSE_LOG_LEVELS = { ...@@ -64,9 +65,6 @@ LIGHTHOUSE_LOG_LEVELS = {
package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "trace", package_io.GLOBAL_CLIENT_LOG_LEVEL.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,
...@@ -98,9 +96,7 @@ def launch( ...@@ -98,9 +96,7 @@ def launch(
beacon_service = add_service(beacon_node_service_id, beacon_config) beacon_service = add_service(beacon_node_service_id, beacon_config)
# TODO check whether its 200, 206 or 503 like golang cl_node_health_checker.wait_for_healthy(beacon_node_service_id, BEACON_HTTP_PORT_ID)
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)
beacon_http_port = beacon_service.ports[BEACON_HTTP_PORT_ID] beacon_http_port = beacon_service.ports[BEACON_HTTP_PORT_ID]
...@@ -120,8 +116,17 @@ def launch( ...@@ -120,8 +116,17 @@ def launch(
validator_service = add_service(validator_node_service_id, validator_config) validator_service = add_service(validator_node_service_id, validator_config)
# TODO(old) add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module # TODO(old) add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module
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_identity_recipe = struct(
beacon_node_enr = wait(service_id = beacon_node_service_id, fact_name = BEACON_ENR_FACT_NAME) service_id = beacon_node_service_id,
method= "GET",
endpoint = "/eth/v1/node/identity",
content_type = "application/json",
port_id = BEACON_HTTP_PORT_ID,
extract = {
"enr": ".data.enr"
}
)
beacon_node_enr = request(beacon_node_identity_recipe)["extract.enr"]
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)
......
...@@ -3,6 +3,7 @@ parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_i ...@@ -3,6 +3,7 @@ parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_i
cl_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_client_context.star") cl_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_client_context.star")
cl_node_metrics = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_metrics_info.star") cl_node_metrics = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_metrics_info.star")
mev_boost_context_module = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/mev_boost/mev_boost_context.star") mev_boost_context_module = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/mev_boost/mev_boost_context.star")
cl_node_health_checker = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_health_checker.star")
package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star") package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star")
...@@ -30,9 +31,6 @@ METRICS_PATH = "/metrics" ...@@ -30,9 +31,6 @@ METRICS_PATH = "/metrics"
PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER"
BEACON_ENR_FACT_NAME = "beacon-enr-fact"
BEACON_HEALTH_FACT_NAME = "beacon-health-fact"
USED_PORTS = { USED_PORTS = {
TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL), TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL),
UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL), UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec(DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL),
...@@ -85,9 +83,7 @@ def launch( ...@@ -85,9 +83,7 @@ def launch(
beacon_http_port = beacon_service.ports[HTTP_PORT_ID] beacon_http_port = beacon_service.ports[HTTP_PORT_ID]
# TODO check whether its 200, 206 or 503 like golang cl_node_health_checker.wait_for_healthy(beacon_node_service_id, HTTP_PORT_ID)
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 = HTTP_PORT_ID))
wait(service_id = beacon_node_service_id, fact_name = BEACON_HEALTH_FACT_NAME)
# Launch validator node # Launch validator node
...@@ -108,8 +104,17 @@ def launch( ...@@ -108,8 +104,17 @@ def launch(
# TODO(old) add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module # TODO(old) add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module
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 = HTTP_PORT_ID)) beacon_node_identity_recipe = struct(
beacon_node_enr = wait(service_id = beacon_node_service_id, fact_name = BEACON_ENR_FACT_NAME) service_id = beacon_node_service_id,
method= "GET",
endpoint = "/eth/v1/node/identity",
content_type = "application/json",
port_id = HTTP_PORT_ID,
extract = {
"enr": ".data.enr"
}
)
beacon_node_enr = request(beacon_node_identity_recipe)["extract.enr"]
beacon_metrics_port = beacon_service.ports[METRICS_PORT_ID] beacon_metrics_port = beacon_service.ports[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)
......
...@@ -2,6 +2,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_u ...@@ -2,6 +2,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_u
parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star") parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star")
cl_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_client_context.star") cl_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_client_context.star")
cl_node_metrics = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_metrics_info.star") cl_node_metrics = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_metrics_info.star")
cl_node_health_checker = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_health_checker.star")
package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star") package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star")
...@@ -56,9 +57,6 @@ NIMBUS_LOG_LEVELS = { ...@@ -56,9 +57,6 @@ NIMBUS_LOG_LEVELS = {
package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "TRACE", package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "TRACE",
} }
ENR_FACT_NAME = "enr-fact"
HEALTH_FACT_NAME = "health-fact"
ENTRYPOINT_ARGS = ["sh", "-c"] ENTRYPOINT_ARGS = ["sh", "-c"]
def launch( def launch(
...@@ -82,12 +80,19 @@ def launch( ...@@ -82,12 +80,19 @@ def launch(
nimbus_service = add_service(service_id, config) nimbus_service = add_service(service_id, config)
# TODO check whether its 200, 206 or 503 like golang cl_node_health_checker.wait_for_healthy(service_id, HTTP_PORT_ID)
define_fact(service_id = service_id, fact_name = HEALTH_FACT_NAME, fact_recipe = struct(method= "GET", endpoint = "/eth/v1/node/health", content_type = "application/json", port_id = HTTP_PORT_ID))
wait(service_id = service_id, fact_name = HEALTH_FACT_NAME) cl_node_identity_recipe = struct(
service_id = service_id,
define_fact(service_id = service_id, fact_name = ENR_FACT_NAME, fact_recipe = struct(method= "GET", endpoint = "/eth/v1/node/identity", field_extractor = ".data.enr", content_type = "application/json", port_id = HTTP_PORT_ID)) method= "GET",
node_enr = wait(service_id = service_id, fact_name = ENR_FACT_NAME) endpoint = "/eth/v1/node/identity",
content_type = "application/json",
port_id = HTTP_PORT_ID,
extract = {
"enr": ".data.enr"
}
)
node_enr = request(cl_node_identity_recipe)["extract.enr"]
metrics_port = nimbus_service.ports[METRICS_PORT_ID] metrics_port = nimbus_service.ports[METRICS_PORT_ID]
metrics_url = "{0}:{1}".format(nimbus_service.ip_address, metrics_port.number) metrics_url = "{0}:{1}".format(nimbus_service.ip_address, metrics_port.number)
......
...@@ -2,6 +2,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_u ...@@ -2,6 +2,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_u
parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star") parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star")
cl_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_client_context.star") cl_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_client_context.star")
cl_node_metrics = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_metrics_info.star") cl_node_metrics = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_metrics_info.star")
cl_node_health_checker = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_health_checker.star")
mev_boost_context_module = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/mev_boost/mev_boost_context.star") mev_boost_context_module = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/mev_boost/mev_boost_context.star")
package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star") package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star")
...@@ -59,9 +60,6 @@ PRYSM_LOG_LEVELS = { ...@@ -59,9 +60,6 @@ PRYSM_LOG_LEVELS = {
package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "trace", package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "trace",
} }
BEACON_ENR_FACT_NAME = "beacon-enr-fact"
BEACON_HEALTH_FACT_NAME = "beacon-health-fact"
def launch( def launch(
launcher, launcher,
...@@ -105,9 +103,7 @@ def launch( ...@@ -105,9 +103,7 @@ def launch(
beacon_service = add_service(beacon_node_service_id, beacon_config) beacon_service = add_service(beacon_node_service_id, beacon_config)
# TODO check whether its 200, 206 or 503 like golang cl_node_health_checker.wait_for_healthy(beacon_node_service_id, HTTP_PORT_ID)
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 = HTTP_PORT_ID))
wait(service_id = beacon_node_service_id, fact_name = BEACON_HEALTH_FACT_NAME)
beacon_http_port = beacon_service.ports[HTTP_PORT_ID] beacon_http_port = beacon_service.ports[HTTP_PORT_ID]
...@@ -132,8 +128,17 @@ def launch( ...@@ -132,8 +128,17 @@ def launch(
validator_service = add_service(validator_node_service_id, validator_config) validator_service = add_service(validator_node_service_id, validator_config)
# TODO(old) add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module # TODO(old) add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module
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 = HTTP_PORT_ID)) beacon_node_identity_recipe = struct(
beacon_node_enr = wait(service_id = beacon_node_service_id, fact_name = BEACON_ENR_FACT_NAME) service_id = beacon_node_service_id,
method= "GET",
endpoint = "/eth/v1/node/identity",
content_type = "application/json",
port_id = HTTP_PORT_ID,
extract = {
"enr": ".data.enr"
}
)
beacon_node_enr = request(beacon_node_identity_recipe)["extract.enr"]
beacon_metrics_port = beacon_service.ports[BEACON_MONITORING_PORT_ID] beacon_metrics_port = beacon_service.ports[BEACON_MONITORING_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)
......
...@@ -2,6 +2,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_u ...@@ -2,6 +2,7 @@ shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_u
parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star") parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star")
cl_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_client_context.star") cl_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_client_context.star")
cl_node_metrics = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_metrics_info.star") cl_node_metrics = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_metrics_info.star")
cl_node_health_checker = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/cl/cl_node_health_checker.star")
mev_boost_context_module = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/mev_boost/mev_boost_context.star") mev_boost_context_module = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/mev_boost/mev_boost_context.star")
package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star") package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star")
...@@ -65,11 +66,6 @@ TEKU_LOG_LEVELS = { ...@@ -65,11 +66,6 @@ TEKU_LOG_LEVELS = {
package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "TRACE", package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "TRACE",
} }
ENR_FACT_NAME = "enr-fact"
HEALTH_FACT_NAME = "health-fact"
def launch( def launch(
launcher, launcher,
service_id, service_id,
...@@ -91,12 +87,19 @@ def launch( ...@@ -91,12 +87,19 @@ def launch(
teku_service = add_service(service_id, config) teku_service = add_service(service_id, config)
# TODO check whether its 200, 206 or 503 like golang cl_node_health_checker.wait_for_healthy(service_id, HTTP_PORT_ID)
define_fact(service_id = service_id, fact_name = HEALTH_FACT_NAME, fact_recipe = struct(method= "GET", endpoint = "/eth/v1/node/health", content_type = "application/json", port_id = HTTP_PORT_ID))
wait(service_id = service_id, fact_name = HEALTH_FACT_NAME) node_identity_recipe = struct(
service_id = service_id,
define_fact(service_id = service_id, fact_name = ENR_FACT_NAME, fact_recipe = struct(method= "GET", endpoint = "/eth/v1/node/identity", field_extractor = ".data.enr", content_type = "application/json", port_id = HTTP_PORT_ID)) method= "GET",
node_enr = wait(service_id = service_id, fact_name = ENR_FACT_NAME) endpoint = "/eth/v1/node/identity",
content_type = "application/json",
port_id = HTTP_PORT_ID,
extract = {
"enr": ".data.enr"
}
)
node_enr = request(node_identity_recipe)["extract.enr"]
teku_metrics_port = teku_service.ports[METRICS_PORT_ID] teku_metrics_port = teku_service.ports[METRICS_PORT_ID]
......
shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_utils/shared_utils.star") shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_utils/shared_utils.star")
parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star") parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star")
el_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_client_context.star") el_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_client_context.star")
el_admin_node_info = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_admin_node_info.star")
package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star") package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star")
# The dirpath of the execution data directory on the client container # The dirpath of the execution data directory on the client container
...@@ -44,8 +44,6 @@ BESU_LOG_LEVELS = { ...@@ -44,8 +44,6 @@ BESU_LOG_LEVELS = {
package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "TRACE", package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "TRACE",
} }
ENODE_FACT_NAME = "enode-fact"
def launch( def launch(
launcher, launcher,
service_id, service_id,
...@@ -62,8 +60,7 @@ def launch( ...@@ -62,8 +60,7 @@ def launch(
service = add_service(service_id, config) service = add_service(service_id, config)
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, enr = el_admin_node_info.get_enode_for_node(service_id, RPC_PORT_ID)
enode = wait(service_id = service_id, fact_name = ENODE_FACT_NAME)
return el_client_context.new_el_client_context( return el_client_context.new_el_client_context(
"besu", "besu",
......
def get_enode_enr_for_node(service_id, port_id):
recipe = struct(
service_id = service_id,
method= "POST",
endpoint = "",
body = '{"method":"admin_nodeInfo","params":[],"id":1,"jsonrpc":"2.0"}',
content_type = "application/json",
port_id = port_id,
extract = {
"enode": ".result.enode",
"enr": ".result.enr",
}
)
response = wait(recipe, "extract.enode", "!=", "")
return (response["extract.enode"], response["extract.enr"])
def get_enode_for_node(service_id, port_id):
recipe = struct(
service_id = service_id,
method= "POST",
endpoint = "",
body = '{"method":"admin_nodeInfo","params":[],"id":1,"jsonrpc":"2.0"}',
content_type = "application/json",
port_id = port_id,
extract = {
"enode": ".result.enode",
}
)
response = wait(recipe, "extract.enode", "!=", "")
return response["extract.enode"]
shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_utils/shared_utils.star") shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_utils/shared_utils.star")
parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star") parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star")
el_admin_node_info = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_admin_node_info.star")
el_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_client_context.star") el_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_client_context.star")
package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star") package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star")
...@@ -41,9 +42,6 @@ ERIGON_LOG_LEVELS = { ...@@ -41,9 +42,6 @@ ERIGON_LOG_LEVELS = {
package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "5", package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "5",
} }
ENR_FACT_NAME = "enr-fact"
ENODE_FACT_NAME = "enode-fact"
def launch( def launch(
launcher, launcher,
service_id, service_id,
...@@ -60,11 +58,7 @@ def launch( ...@@ -60,11 +58,7 @@ def launch(
service = add_service(service_id, config) service = add_service(service_id, config)
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)) enode, enr = el_admin_node_info.get_enode_enr_for_node(service_id, RPC_PORT_ID)
enr = wait(service_id = service_id, fact_name = ENR_FACT_NAME)
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 el_client_context.new_el_client_context( return el_client_context.new_el_client_context(
"erigon", "erigon",
......
shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_utils/shared_utils.star") shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_utils/shared_utils.star")
parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star") parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star")
el_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_client_context.star") el_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_client_context.star")
el_admin_node_info = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_admin_node_info.star")
package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star") package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star")
...@@ -44,9 +45,6 @@ USED_PORTS = { ...@@ -44,9 +45,6 @@ USED_PORTS = {
ENTRYPOINT_ARGS = ["sh", "-c"] ENTRYPOINT_ARGS = ["sh", "-c"]
ENR_FACT_NAME = "enr-fact"
ENODE_FACT_NAME = "enode-fact"
VERBOSITY_LEVELS = { VERBOSITY_LEVELS = {
package_io.GLOBAL_CLIENT_LOG_LEVEL.error: "1", package_io.GLOBAL_CLIENT_LOG_LEVEL.error: "1",
package_io.GLOBAL_CLIENT_LOG_LEVEL.warn: "2", package_io.GLOBAL_CLIENT_LOG_LEVEL.warn: "2",
...@@ -73,11 +71,7 @@ def launch( ...@@ -73,11 +71,7 @@ def launch(
service = add_service(service_id, config) service = add_service(service_id, config)
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)) enode, enr = el_admin_node_info.get_enode_enr_for_node(service_id, RPC_PORT_ID)
enr = wait(service_id = service_id, fact_name = ENR_FACT_NAME)
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 el_client_context.new_el_client_context( return el_client_context.new_el_client_context(
"geth", "geth",
......
shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_utils/shared_utils.star") shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_utils/shared_utils.star")
parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star") parse_input = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/parse_input.star")
el_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_client_context.star") el_client_context = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_client_context.star")
el_admin_node_info = import_module("github.com/kurtosis-tech/eth2-package/src/participant_network/el/el_admin_node_info.star")
package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star") package_io = import_module("github.com/kurtosis-tech/eth2-package/src/package_io/constants.star")
...@@ -39,9 +40,6 @@ NETHERMIND_LOG_LEVELS = { ...@@ -39,9 +40,6 @@ NETHERMIND_LOG_LEVELS = {
package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "TRACE", package_io.GLOBAL_CLIENT_LOG_LEVEL.trace: "TRACE",
} }
ENODE_FACT_NAME = "enode-fact"
def launch( def launch(
launcher, launcher,
service_id, service_id,
...@@ -57,8 +55,7 @@ def launch( ...@@ -57,8 +55,7 @@ def launch(
service = add_service(service_id, config) service = add_service(service_id, config)
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 = el_admin_node_info.get_enode_for_node(service_id, RPC_PORT_ID)
enode = wait(service_id = service_id, fact_name = ENODE_FACT_NAME)
return el_client_context.new_el_client_context( return el_client_context.new_el_client_context(
"nethermind", "nethermind",
......
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