Skip to content

Commit b824cac

Browse files
authored
feat: add sanity check (#710)
1 parent 2d1cab5 commit b824cac

File tree

5 files changed

+317
-4
lines changed

5 files changed

+317
-4
lines changed

.github/tests/mev.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ additional_services:
1111
- dora
1212
- prometheus_grafana
1313
mev_params:
14-
launch_custom_flood: true
1514
mev_relay_image: flashbots/mev-boost-relay:latest
1615
network_params:
1716
seconds_per_slot: 3

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ participants:
286286

287287
# Whether to use a separate validator client attached to the CL client.
288288
# Defaults to false for clients that can run both in one process (Teku, Nimbus)
289-
use_separate_vc: false
289+
use_separate_vc: true
290290

291291
# VC (Validator Client) Specific flags
292292
# The type of validator client that should be used
@@ -501,7 +501,7 @@ network_params:
501501

502502
# EOF activation fork epoch (EL only fork)
503503
# Defaults to null
504-
eof_activation_fork_epoch: null
504+
eof_activation_epoch: null
505505

506506
# Network sync base url for syncing public networks from a custom snapshot (mostly useful for shadowforks)
507507
# Defaults to "https://ethpandaops-ethereum-node-snapshots.ams3.cdn.digitaloceanspaces.com/

network_params.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ network_params:
8383
target_number_of_peers: 70
8484
additional_preloaded_contracts: {}
8585
devnet_repo: ethpandaops
86-
checkpoint_sync_enabled: false
8786
additional_services: []
8887
dora_params:
8988
image: ""
@@ -146,6 +145,8 @@ apache_port: 40000
146145
global_tolerations: []
147146
global_node_selectors: {}
148147
keymanager_enabled: false
148+
checkpoint_sync_enabled: false
149+
checkpoint_sync_url: ""
149150
port_publisher:
150151
nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER
151152
el:

src/package_io/input_parser.star

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ genesis_constants = import_module(
44
"../prelaunch_data_generator/genesis_constants/genesis_constants.star"
55
)
66

7+
sanity_check = import_module("./sanity_check.star")
8+
79
DEFAULT_EL_IMAGES = {
810
"geth": "ethereum/client-go:latest",
911
"erigon": "ethpandaops/erigon:main",
@@ -78,6 +80,7 @@ ATTR_TO_BE_SKIPPED_AT_ROOT = (
7880

7981

8082
def input_parser(plan, input_args):
83+
sanity_check.sanity_check(plan, input_args)
8184
result = parse_network_params(plan, input_args)
8285

8386
# add default eth2 input params

src/package_io/sanity_check.star

Lines changed: 310 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,310 @@
1+
PARTICIPANT_CATEGORIES = {
2+
"participants": [
3+
"el_type",
4+
"el_image",
5+
"el_log_level",
6+
"el_extra_env_vars",
7+
"el_extra_labels",
8+
"el_extra_params",
9+
"el_tolerations",
10+
"el_volume_size",
11+
"el_min_cpu",
12+
"el_max_cpu",
13+
"el_min_mem",
14+
"el_max_mem",
15+
"cl_type",
16+
"cl_image",
17+
"cl_log_level",
18+
"cl_extra_env_vars",
19+
"cl_extra_labels",
20+
"cl_extra_params",
21+
"cl_tolerations",
22+
"cl_volume_size",
23+
"cl_min_cpu",
24+
"cl_max_cpu",
25+
"cl_min_mem",
26+
"cl_max_mem",
27+
"use_separate_vc",
28+
"vc_type",
29+
"vc_image",
30+
"vc_count",
31+
"vc_log_level",
32+
"vc_extra_env_vars",
33+
"vc_extra_labels",
34+
"vc_extra_params",
35+
"vc_tolerations",
36+
"vc_min_cpu",
37+
"vc_max_cpu",
38+
"vc_min_mem",
39+
"vc_max_mem",
40+
"validator_count",
41+
"node_selectors",
42+
"tolerations",
43+
"count",
44+
"snooper_enabled",
45+
"ethereum_metrics_exporter_enabled",
46+
"xatu_sentry_enabled",
47+
"prometheus_config",
48+
"blobber_enabled",
49+
"blobber_extra_params",
50+
"builder_network_params",
51+
"keymanager_enabled",
52+
],
53+
}
54+
55+
PARTICIPANT_MATRIX_PARAMS = {
56+
"participants_matrix": {
57+
"el": [
58+
"el_type",
59+
"el_image",
60+
"el_log_level",
61+
"el_extra_env_vars",
62+
"el_extra_labels",
63+
"el_extra_params",
64+
"el_tolerations",
65+
"el_volume_size",
66+
"el_min_cpu",
67+
"el_max_cpu",
68+
"el_min_mem",
69+
"el_max_mem",
70+
],
71+
"cl": [
72+
"cl_type",
73+
"cl_image",
74+
"cl_log_level",
75+
"cl_extra_env_vars",
76+
"cl_extra_labels",
77+
"cl_extra_params",
78+
"cl_tolerations",
79+
"cl_volume_size",
80+
"cl_min_cpu",
81+
"cl_max_cpu",
82+
"cl_min_mem",
83+
"cl_max_mem",
84+
"use_separate_vc",
85+
],
86+
"vc": [
87+
"vc_type",
88+
"vc_image",
89+
"vc_count",
90+
"vc_log_level",
91+
"vc_extra_env_vars",
92+
"vc_extra_labels",
93+
"vc_extra_params",
94+
"vc_tolerations",
95+
"vc_min_cpu",
96+
"vc_max_cpu",
97+
"vc_min_mem",
98+
"vc_max_mem",
99+
],
100+
},
101+
}
102+
103+
SUBCATEGORY_PARAMS = {
104+
"network_params": [
105+
"network",
106+
"network_id",
107+
"deposit_contract_address",
108+
"seconds_per_slot",
109+
"num_validator_keys_per_node",
110+
"preregistered_validator_keys_mnemonic",
111+
"preregistered_validator_count",
112+
"genesis_delay",
113+
"max_per_epoch_activation_churn_limit",
114+
"churn_limit_quotient",
115+
"ejection_balance",
116+
"eth1_follow_distance",
117+
"min_validator_withdrawability_delay",
118+
"shard_committee_period",
119+
"deneb_fork_epoch",
120+
"electra_fork_epoch",
121+
"eip7594_fork_epoch",
122+
"eip7594_fork_version",
123+
"eof_activation_epoch",
124+
"network_sync_base_url",
125+
"data_column_sidecar_subnet_count",
126+
"samples_per_slot",
127+
"custody_requirement",
128+
"target_number_of_peers",
129+
"preset",
130+
"additional_preloaded_contracts",
131+
"devnet_repo",
132+
],
133+
"dora_params": [
134+
"image",
135+
"env",
136+
],
137+
"tx_spammer_params": [
138+
"tx_spammer_extra_args",
139+
],
140+
"goomy_blob_params": [
141+
"goomy_blob_args",
142+
],
143+
"assertoor_params": [
144+
"image",
145+
"run_stability_check",
146+
"run_block_proposal_check",
147+
"run_transaction_test",
148+
"run_blob_transaction_test",
149+
"run_opcodes_transaction_test",
150+
"run_lifecycle_test",
151+
"tests",
152+
],
153+
"mev_params": [
154+
"mev_relay_image",
155+
"mev_builder_image",
156+
"mev_builder_cl_image",
157+
"mev_boost_image",
158+
"mev_boost_args",
159+
"mev_relay_api_extra_args",
160+
"mev_relay_housekeeper_extra_args",
161+
"mev_relay_website_extra_args",
162+
"mev_builder_extra_args",
163+
"mev_builder_prometheus_config",
164+
"mev_flood_image",
165+
"mev_flood_extra_args",
166+
"mev_flood_seconds_per_bundle",
167+
"custom_flood_params",
168+
],
169+
"xatu_sentry_params": [
170+
"xatu_sentry_image",
171+
"xatu_server_addr",
172+
"xatu_server_tls",
173+
"xatu_server_headers",
174+
"beacon_subscriptions",
175+
],
176+
"port_publisher": [
177+
"nat_exit_ip",
178+
"el",
179+
"cl",
180+
"vc",
181+
"additional_services",
182+
],
183+
}
184+
185+
ADDITIONAL_SERVICES_PARAMS = [
186+
"assertoor",
187+
"broadcaster",
188+
"tx_spammer",
189+
"blob_spammer",
190+
"custom_flood",
191+
"goomy_blob",
192+
"el_forkmon",
193+
"blockscout",
194+
"beacon_metrics_gazer",
195+
"dora",
196+
"full_beaconchain_explorer",
197+
"prometheus_grafana",
198+
"blobscan",
199+
"dugtrio",
200+
"blutgang",
201+
"forky",
202+
"apache",
203+
"tracoor",
204+
]
205+
206+
ADDITIONAL_CATEGORY_PARAMS = {
207+
"wait_for_finalization": "",
208+
"global_log_level": "",
209+
"snooper_enabled": "",
210+
"ethereum_metrics_exporter_enabled": "",
211+
"parallel_keystore_generation": "",
212+
"disable_peer_scoring": "",
213+
"grafana_additional_dashboards": "",
214+
"persistent": "",
215+
"mev_type": "",
216+
"xatu_sentry_enabled": "",
217+
"apache_port": "",
218+
"global_tolerations": "",
219+
"global_node_selectors": "",
220+
"keymanager_enabled": "",
221+
"checkpoint_sync_enabled": "",
222+
"checkpoint_sync_url": "",
223+
}
224+
225+
226+
def deep_validate_params(plan, input_args, category, allowed_params):
227+
if category in input_args:
228+
for item in input_args[category]:
229+
for param in item.keys():
230+
if param not in allowed_params:
231+
fail(
232+
"Invalid parameter {0} for {1}. Allowed fields: {2}".format(
233+
param, category, allowed_params
234+
)
235+
)
236+
237+
238+
def validate_params(plan, input_args, category, allowed_params):
239+
if category in input_args:
240+
for param in input_args[category].keys():
241+
if param not in allowed_params:
242+
fail(
243+
"Invalid parameter {0} for {1}. Allowed fields: {2}".format(
244+
param, category, allowed_params
245+
)
246+
)
247+
248+
249+
def sanity_check(plan, input_args):
250+
# Checks participants
251+
deep_validate_params(
252+
plan, input_args, "participants", PARTICIPANT_CATEGORIES["participants"]
253+
)
254+
# Checks participants_matrix
255+
if "participants_matrix" in input_args:
256+
for sub_matrix_participant in input_args["participants_matrix"]:
257+
if (
258+
sub_matrix_participant
259+
not in PARTICIPANT_MATRIX_PARAMS["participants_matrix"]
260+
):
261+
fail(
262+
"Invalid parameter {0} for participants_matrix, allowed fields: {1}".format(
263+
sub_matrix_participant,
264+
PARTICIPANT_MATRIX_PARAMS["participants_matrix"].keys(),
265+
)
266+
)
267+
else:
268+
deep_validate_params(
269+
plan,
270+
input_args["participants_matrix"],
271+
sub_matrix_participant,
272+
PARTICIPANT_MATRIX_PARAMS["participants_matrix"][
273+
sub_matrix_participant
274+
],
275+
)
276+
277+
# Checks additional services
278+
if "additional_services" in input_args:
279+
for additional_services in input_args["additional_services"]:
280+
if additional_services not in ADDITIONAL_SERVICES_PARAMS:
281+
fail(
282+
"Invalid additional_services {0}, allowed fields: {1}".format(
283+
additional_services, ADDITIONAL_SERVICES_PARAMS
284+
)
285+
)
286+
287+
# Checks subcategories
288+
for subcategories in SUBCATEGORY_PARAMS.keys():
289+
validate_params(
290+
plan, input_args, subcategories, SUBCATEGORY_PARAMS[subcategories]
291+
)
292+
# Checks everything else
293+
for param in input_args.keys():
294+
combined_root_params = (
295+
PARTICIPANT_CATEGORIES.keys()
296+
+ PARTICIPANT_MATRIX_PARAMS.keys()
297+
+ SUBCATEGORY_PARAMS.keys()
298+
+ ADDITIONAL_CATEGORY_PARAMS.keys()
299+
)
300+
combined_root_params.append("additional_services")
301+
302+
if param not in combined_root_params:
303+
fail(
304+
"Invalid parameter {0}, allowed fields {1}".format(
305+
param, combined_root_params
306+
)
307+
)
308+
309+
# If everything passes, print a message
310+
plan.print("Sanity check passed")

0 commit comments

Comments
 (0)