Skip to content

Commit 8e5d185

Browse files
authored
fix!: Use plan object (ethereum#65)
BREAKING-CHANGE: Uses the `plan` object. Users will have to update their Kurtosis CLI to >= 0.63.0 and restart the engine
1 parent 4f350ba commit 8e5d185

File tree

24 files changed

+155
-126
lines changed

24 files changed

+155
-126
lines changed

.circleci/config.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ workflows:
4040
# -- PR check jobs ------------------------------------------
4141
- kurtosis-docs-checker/check-docs:
4242
should-check-changelog: false
43-
markdown-link-check-config-json: "{}"
43+
markdown-link-check-config-json: |
44+
{
45+
"ignorePatterns": [
46+
{
47+
"pattern": "https://github.com/kurtosis-tech/eth2-package"
48+
}
49+
]
50+
}
4451
filters:
4552
branches:
4653
ignore:

main.star

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ GRAFANA_DASHBOARD_PATH_URL = "/d/QdTOwy-nz/eth2-merge-kurtosis-module-dashboard?
1717
FIRST_NODE_FINALIZATION_FACT = "cl-boot-finalization-fact"
1818
HTTP_PORT_ID_FOR_FACT = "http"
1919

20-
def run(args):
20+
def run(plan, args):
2121
args_with_right_defaults = parse_input.parse_input(args)
2222

2323
num_participants = len(args_with_right_defaults.participants)
@@ -27,10 +27,10 @@ def run(args):
2727
grafana_dashboards_config_template = read_file(static_files.GRAFANA_DASHBOARD_PROVIDERS_CONFIG_TEMPLATE_FILEPATH)
2828
prometheus_config_template = read_file(static_files.PROMETHEUS_CONFIG_TEMPLATE_FILEPATH)
2929

30-
print("Read the prometheus, grafana templates")
30+
plan.print("Read the prometheus, grafana templates")
3131

32-
print("Launching participant network with {0} participants and the following network params {1}".format(num_participants, network_params))
33-
all_participants, cl_gensis_timestamp = participant_network.launch_participant_network(args_with_right_defaults.participants, network_params, args_with_right_defaults.global_client_log_level)
32+
plan.print("Launching participant network with {0} participants and the following network params {1}".format(num_participants, network_params))
33+
all_participants, cl_gensis_timestamp = participant_network.launch_participant_network(plan, args_with_right_defaults.participants, network_params, args_with_right_defaults.global_client_log_level)
3434

3535
all_el_client_contexts = []
3636
all_cl_client_contexts = []
@@ -42,39 +42,40 @@ def run(args):
4242
if not args_with_right_defaults.launch_additional_services:
4343
return
4444

45-
print("Launching transaction spammer")
46-
transaction_spammer.launch_transaction_spammer(genesis_constants.PRE_FUNDED_ACCOUNTS, all_el_client_contexts[0])
47-
print("Succesfully launched transaction spammer")
45+
plan.print("Launching transaction spammer")
46+
transaction_spammer.launch_transaction_spammer(plan, genesis_constants.PRE_FUNDED_ACCOUNTS, all_el_client_contexts[0])
47+
plan.print("Succesfully launched transaction spammer")
4848

4949
# We need a way to do time.sleep
5050
# TODO add code that waits for CL genesis
5151

52-
print("Launching forkmon")
52+
plan.print("Launching forkmon")
5353
forkmon_config_template = read_file(static_files.FORKMON_CONFIG_TEMPLATE_FILEPATH)
54-
forkmon.launch_forkmon(forkmon_config_template, all_cl_client_contexts, cl_gensis_timestamp, network_params.seconds_per_slot, network_params.slots_per_epoch)
55-
print("Succesfully launched forkmon")
54+
forkmon.launch_forkmon(plan, forkmon_config_template, all_cl_client_contexts, cl_gensis_timestamp, network_params.seconds_per_slot, network_params.slots_per_epoch)
55+
plan.print("Succesfully launched forkmon")
5656

57-
print("Launching prometheus...")
57+
plan.print("Launching prometheus...")
5858
prometheus_private_url = prometheus.launch_prometheus(
59+
plan,
5960
prometheus_config_template,
6061
all_cl_client_contexts,
6162
)
62-
print("Successfully launched Prometheus")
63+
plan.print("Successfully launched Prometheus")
6364

64-
print("Launching grafana...")
65-
grafana.launch_grafana(grafana_datasource_config_template, grafana_dashboards_config_template, prometheus_private_url)
66-
print("Succesfully launched grafana")
65+
plan.print("Launching grafana...")
66+
grafana.launch_grafana(plan, grafana_datasource_config_template, grafana_dashboards_config_template, prometheus_private_url)
67+
plan.print("Succesfully launched grafana")
6768

6869
if args_with_right_defaults.wait_for_verifications:
69-
print("Running synchrnous testnet verifier")
70-
testnet_verifier.run_synchronous_testnet_verification(args_with_right_defaults, all_el_client_contexts, all_cl_client_contexts)
71-
print("Verification succeeded")
70+
plan.print("Running synchrnous testnet verifier")
71+
testnet_verifier.run_synchronous_testnet_verification(plan, args_with_right_defaults, all_el_client_contexts, all_cl_client_contexts)
72+
plan.print("Verification succeeded")
7273
else:
73-
print("Running asynchronous verification")
74-
testnet_verifier.launch_testnet_verifier(args_with_right_defaults, all_el_client_contexts, all_cl_client_contexts)
75-
print("Succesfully launched asynchronous verifier")
74+
plan.print("Running asynchronous verification")
75+
testnet_verifier.launch_testnet_verifier(plan, args_with_right_defaults, all_el_client_contexts, all_cl_client_contexts)
76+
plan.print("Succesfully launched asynchronous verifier")
7677
if args_with_right_defaults.wait_for_finalization:
77-
print("Waiting for the first finalized epoch")
78+
plan.print("Waiting for the first finalized epoch")
7879
first_cl_client = all_cl_client_contexts[0]
7980
first_cl_client_id = first_cl_client.beacon_service_id
8081
epoch_recipe = struct(
@@ -87,8 +88,8 @@ def run(args):
8788
"finalized_epoch": ".data.finalized.epoch"
8889
}
8990
)
90-
wait(epoch_recipe, "extract.finalized_epoch", "!=", "0", timeout="40m")
91-
print("First finalized epoch occurred successfully")
91+
plan.wait(epoch_recipe, "extract.finalized_epoch", "!=", "0", timeout="40m")
92+
plan.print("First finalized epoch occurred successfully")
9293

9394

9495
grafana_info = struct(

src/forkmon/forkmon_launcher.star

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ USED_PORTS = {
1717

1818

1919
def launch_forkmon(
20+
plan,
2021
config_template,
2122
cl_client_contexts,
2223
genesis_unix_timestamp,
@@ -35,11 +36,11 @@ def launch_forkmon(
3536
template_and_data_by_rel_dest_filepath = {}
3637
template_and_data_by_rel_dest_filepath[FORKMON_CONFIG_FILENAME] = template_and_data
3738

38-
config_files_artifact_uuid = render_templates(template_and_data_by_rel_dest_filepath)
39+
config_files_artifact_uuid = plan.render_templates(template_and_data_by_rel_dest_filepath)
3940

4041
config = get_config(config_files_artifact_uuid)
4142

42-
add_service(SERVICE_ID, config)
43+
plan.add_service(SERVICE_ID, config)
4344

4445

4546
def get_config(config_files_artifact_uuid):

src/grafana/grafana_launcher.star

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ USED_PORTS = {
2525
}
2626

2727

28-
def launch_grafana(datasource_config_template, dashboard_providers_config_template, prometheus_private_url):
29-
grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid = get_grafana_config_dir_artifact_uuid(datasource_config_template, dashboard_providers_config_template, prometheus_private_url)
28+
def launch_grafana(plan, datasource_config_template, dashboard_providers_config_template, prometheus_private_url):
29+
grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid = get_grafana_config_dir_artifact_uuid(plan, datasource_config_template, dashboard_providers_config_template, prometheus_private_url)
3030

3131
config = get_config(grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid)
3232

33-
add_service(SERVICE_ID, config)
33+
plan.add_service(SERVICE_ID, config)
3434

3535

36-
def get_grafana_config_dir_artifact_uuid(datasource_config_template, dashboard_providers_config_template, prometheus_private_url):
36+
def get_grafana_config_dir_artifact_uuid(plan, datasource_config_template, dashboard_providers_config_template, prometheus_private_url):
3737
datasource_data = new_datasource_config_template_data(prometheus_private_url)
3838
datasource_template_and_data = shared_utils.new_template_and_data(datasource_config_template, datasource_data)
3939

@@ -44,9 +44,9 @@ def get_grafana_config_dir_artifact_uuid(datasource_config_template, dashboard_p
4444
template_and_data_by_rel_dest_filepath[DATASOURCE_CONFIG_REL_FILEPATH] = datasource_template_and_data
4545
template_and_data_by_rel_dest_filepath[DASHBOARD_PROVIDERS_CONFIG_REL_FILEPATH] = dashboard_providers_template_and_data
4646

47-
grafana_config_artifacts_uuid = render_templates(template_and_data_by_rel_dest_filepath)
47+
grafana_config_artifacts_uuid = plan.render_templates(template_and_data_by_rel_dest_filepath)
4848

49-
grafana_dashboards_artifacts_uuid = upload_files(static_files.GRAFANA_DASHBOARDS_CONFIG_DIRPATH)
49+
grafana_dashboards_artifacts_uuid = plan.upload_files(static_files.GRAFANA_DASHBOARDS_CONFIG_DIRPATH)
5050

5151
return grafana_config_artifacts_uuid, grafana_dashboards_artifacts_uuid
5252

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
def wait_for_healthy(service_id, port_id):
1+
def wait_for_healthy(plan, service_id, port_id):
22
recipe = struct(
33
service_id = service_id,
44
method= "GET",
55
endpoint = "/eth/v1/node/health",
66
content_type = "application/json",
77
port_id = port_id
88
)
9-
return wait(recipe, "code", "IN", [200, 206, 503])
9+
return plan.wait(recipe, "code", "IN", [200, 206, 503])

src/participant_network/cl/lighthouse/lighthouse_launcher.star

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ LIGHTHOUSE_LOG_LEVELS = {
6666
}
6767

6868
def launch(
69+
plan,
6970
launcher,
7071
service_id,
7172
image,
@@ -94,9 +95,9 @@ def launch(
9495
extra_beacon_params,
9596
)
9697

97-
beacon_service = add_service(beacon_node_service_id, beacon_config)
98+
beacon_service = plan.add_service(beacon_node_service_id, beacon_config)
9899

99-
cl_node_health_checker.wait_for_healthy(beacon_node_service_id, BEACON_HTTP_PORT_ID)
100+
cl_node_health_checker.wait_for_healthy(plan, beacon_node_service_id, BEACON_HTTP_PORT_ID)
100101

101102
beacon_http_port = beacon_service.ports[BEACON_HTTP_PORT_ID]
102103

@@ -113,7 +114,7 @@ def launch(
113114
extra_validator_params,
114115
)
115116

116-
validator_service = add_service(validator_node_service_id, validator_config)
117+
validator_service = plan.add_service(validator_node_service_id, validator_config)
117118

118119
# TODO(old) add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module
119120
beacon_node_identity_recipe = struct(
@@ -126,7 +127,7 @@ def launch(
126127
"enr": ".data.enr"
127128
}
128129
)
129-
beacon_node_enr = request(beacon_node_identity_recipe)["extract.enr"]
130+
beacon_node_enr = plan.request(beacon_node_identity_recipe)["extract.enr"]
130131

131132
beacon_metrics_port = beacon_service.ports[BEACON_METRICS_PORT_ID]
132133
beacon_metrics_url = "{0}:{1}".format(beacon_service.ip_address, beacon_metrics_port.number)

src/participant_network/cl/lodestar/lodestar_launcher.star

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ USED_PORTS = {
4040
}
4141

4242

43-
4443
LODESTAR_LOG_LEVELS = {
4544
package_io.GLOBAL_CLIENT_LOG_LEVEL.error: "error",
4645
package_io.GLOBAL_CLIENT_LOG_LEVEL.warn: "warn",
@@ -51,6 +50,7 @@ LODESTAR_LOG_LEVELS = {
5150

5251

5352
def launch(
53+
plan,
5454
launcher,
5555
service_id,
5656
image,
@@ -79,11 +79,11 @@ def launch(
7979
extra_beacon_params,
8080
)
8181

82-
beacon_service = add_service(beacon_node_service_id, beacon_config)
82+
beacon_service = plan.add_service(beacon_node_service_id, beacon_config)
8383

8484
beacon_http_port = beacon_service.ports[HTTP_PORT_ID]
8585

86-
cl_node_health_checker.wait_for_healthy(beacon_node_service_id, HTTP_PORT_ID)
86+
cl_node_health_checker.wait_for_healthy(plan, beacon_node_service_id, HTTP_PORT_ID)
8787

8888

8989
# Launch validator node
@@ -100,7 +100,7 @@ def launch(
100100
extra_validator_params,
101101
)
102102

103-
validator_service = add_service(validator_node_service_id, validator_config)
103+
validator_service = plan.add_service(validator_node_service_id, validator_config)
104104

105105
# TODO(old) add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module
106106

@@ -114,7 +114,7 @@ def launch(
114114
"enr": ".data.enr"
115115
}
116116
)
117-
beacon_node_enr = request(beacon_node_identity_recipe)["extract.enr"]
117+
beacon_node_enr = plan.request(beacon_node_identity_recipe)["extract.enr"]
118118

119119
beacon_metrics_port = beacon_service.ports[METRICS_PORT_ID]
120120
beacon_metrics_url = "{0}:{1}".format(beacon_service.ip_address, beacon_metrics_port.number)

src/participant_network/cl/nimbus/nimbus_launcher.star

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ NIMBUS_LOG_LEVELS = {
6060
ENTRYPOINT_ARGS = ["sh", "-c"]
6161

6262
def launch(
63+
plan,
6364
launcher,
6465
service_id,
6566
image,
@@ -78,9 +79,9 @@ def launch(
7879

7980
config = get_config(launcher.cl_genesis_data, image, bootnode_context, el_client_context, mev_boost_context, log_level, node_keystore_files, extra_params)
8081

81-
nimbus_service = add_service(service_id, config)
82+
nimbus_service = plan.add_service(service_id, config)
8283

83-
cl_node_health_checker.wait_for_healthy(service_id, HTTP_PORT_ID)
84+
cl_node_health_checker.wait_for_healthy(plan, service_id, HTTP_PORT_ID)
8485

8586
cl_node_identity_recipe = struct(
8687
service_id = service_id,
@@ -92,7 +93,7 @@ def launch(
9293
"enr": ".data.enr"
9394
}
9495
)
95-
node_enr = request(cl_node_identity_recipe)["extract.enr"]
96+
node_enr = plan.request(cl_node_identity_recipe)["extract.enr"]
9697

9798
metrics_port = nimbus_service.ports[METRICS_PORT_ID]
9899
metrics_url = "{0}:{1}".format(nimbus_service.ip_address, metrics_port.number)

src/participant_network/cl/prysm/prysm_launcher.star

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ PRYSM_LOG_LEVELS = {
6262

6363

6464
def launch(
65+
plan,
6566
launcher,
6667
service_id,
6768
images,
@@ -101,9 +102,9 @@ def launch(
101102
extra_beacon_params,
102103
)
103104

104-
beacon_service = add_service(beacon_node_service_id, beacon_config)
105+
beacon_service = plan.add_service(beacon_node_service_id, beacon_config)
105106

106-
cl_node_health_checker.wait_for_healthy(beacon_node_service_id, HTTP_PORT_ID)
107+
cl_node_health_checker.wait_for_healthy(plan, beacon_node_service_id, HTTP_PORT_ID)
107108

108109
beacon_http_port = beacon_service.ports[HTTP_PORT_ID]
109110

@@ -125,7 +126,7 @@ def launch(
125126
launcher.prysm_password_artifact_uuid
126127
)
127128

128-
validator_service = add_service(validator_node_service_id, validator_config)
129+
validator_service = plan.add_service(validator_node_service_id, validator_config)
129130

130131
# TODO(old) add validator availability using the validator API: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v1#/ValidatorRequiredApi | from eth2-merge-kurtosis-module
131132
beacon_node_identity_recipe = struct(
@@ -138,7 +139,7 @@ def launch(
138139
"enr": ".data.enr"
139140
}
140141
)
141-
beacon_node_enr = request(beacon_node_identity_recipe)["extract.enr"]
142+
beacon_node_enr = plan.request(beacon_node_identity_recipe)["extract.enr"]
142143

143144
beacon_metrics_port = beacon_service.ports[BEACON_MONITORING_PORT_ID]
144145
beacon_metrics_url = "{0}:{1}".format(beacon_service.ip_address, beacon_metrics_port.number)

src/participant_network/cl/teku/teku_launcher.star

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ TEKU_LOG_LEVELS = {
6767
}
6868

6969
def launch(
70+
plan,
7071
launcher,
7172
service_id,
7273
image,
@@ -85,9 +86,9 @@ def launch(
8586

8687
config = get_config(launcher.cl_genesis_data, image, bootnode_context, el_client_context, mev_boost_context, log_level, node_keystore_files, extra_params)
8788

88-
teku_service = add_service(service_id, config)
89+
teku_service = plan.add_service(service_id, config)
8990

90-
cl_node_health_checker.wait_for_healthy(service_id, HTTP_PORT_ID)
91+
cl_node_health_checker.wait_for_healthy(plan, service_id, HTTP_PORT_ID)
9192

9293
node_identity_recipe = struct(
9394
service_id = service_id,
@@ -99,7 +100,7 @@ def launch(
99100
"enr": ".data.enr"
100101
}
101102
)
102-
node_enr = request(node_identity_recipe)["extract.enr"]
103+
node_enr = plan.request(node_identity_recipe)["extract.enr"]
103104

104105

105106
teku_metrics_port = teku_service.ports[METRICS_PORT_ID]

0 commit comments

Comments
 (0)