@@ -138,6 +138,46 @@ PARTICIPANT_MATRIX_PARAMS = {
138
138
},
139
139
}
140
140
141
+ PORT_PUBLISHER_PARAMS = {
142
+ "port_publisher" : {
143
+ "el" : [
144
+ "enabled" ,
145
+ "public_port_start" ,
146
+ "nat_exit_ip" ,
147
+ ],
148
+ "cl" : [
149
+ "enabled" ,
150
+ "public_port_start" ,
151
+ "nat_exit_ip" ,
152
+ ],
153
+ "vc" : [
154
+ "enabled" ,
155
+ "public_port_start" ,
156
+ "nat_exit_ip" ,
157
+ ],
158
+ "remote_signer" : [
159
+ "enabled" ,
160
+ "public_port_start" ,
161
+ "nat_exit_ip" ,
162
+ ],
163
+ "additional_services" : [
164
+ "enabled" ,
165
+ "public_port_start" ,
166
+ "nat_exit_ip" ,
167
+ ],
168
+ "mev" : [
169
+ "enabled" ,
170
+ "public_port_start" ,
171
+ "nat_exit_ip" ,
172
+ ],
173
+ "other" : [
174
+ "enabled" ,
175
+ "public_port_start" ,
176
+ "nat_exit_ip" ,
177
+ ],
178
+ },
179
+ }
180
+
141
181
SUBCATEGORY_PARAMS = {
142
182
"network_params" : [
143
183
"network" ,
@@ -289,16 +329,6 @@ SUBCATEGORY_PARAMS = {
289
329
"ethereum_genesis_generator_params" : [
290
330
"image" ,
291
331
],
292
- "port_publisher" : [
293
- "nat_exit_ip" ,
294
- "el" ,
295
- "cl" ,
296
- "vc" ,
297
- "remote_signer" ,
298
- "additional_services" ,
299
- "mev" ,
300
- "other" ,
301
- ],
302
332
}
303
333
304
334
ADDITIONAL_SERVICES_PARAMS = [
@@ -366,12 +396,41 @@ def validate_params(plan, input_args, category, allowed_params):
366
396
)
367
397
368
398
399
+ def validate_nested_params (
400
+ plan , input_args , category , nested_param_definition , special_keys = None
401
+ ):
402
+ if category not in input_args :
403
+ return
404
+
405
+ special_keys = special_keys or []
406
+ allowed_top_level_keys = list (nested_param_definition .keys ()) + special_keys
407
+
408
+ # Validate top-level keys
409
+ for param in input_args [category ].keys ():
410
+ if param not in allowed_top_level_keys :
411
+ fail (
412
+ "Invalid parameter {0} for {1}, allowed fields: {2}" .format (
413
+ param , category , allowed_top_level_keys
414
+ )
415
+ )
416
+
417
+ # Validate nested parameters
418
+ for sub_param in input_args [category ]:
419
+ if sub_param not in special_keys and sub_param in nested_param_definition :
420
+ validate_params (
421
+ plan ,
422
+ input_args [category ],
423
+ sub_param ,
424
+ nested_param_definition [sub_param ],
425
+ )
426
+
427
+
369
428
def sanity_check (plan , input_args ):
370
429
# Checks participants
371
430
deep_validate_params (
372
431
plan , input_args , "participants" , PARTICIPANT_CATEGORIES ["participants" ]
373
432
)
374
- # Checks participants_matrix
433
+ # Checks participants_matrix (uses original logic for arrays of objects)
375
434
if "participants_matrix" in input_args :
376
435
for sub_matrix_participant in input_args ["participants_matrix" ]:
377
436
if (
@@ -394,6 +453,15 @@ def sanity_check(plan, input_args):
394
453
],
395
454
)
396
455
456
+ # Checks port_publisher (uses new generic validation for key-value mappings)
457
+ validate_nested_params (
458
+ plan ,
459
+ input_args ,
460
+ "port_publisher" ,
461
+ PORT_PUBLISHER_PARAMS ["port_publisher" ],
462
+ ["nat_exit_ip" ],
463
+ )
464
+
397
465
# Checks additional services
398
466
if "additional_services" in input_args :
399
467
for additional_services in input_args ["additional_services" ]:
@@ -414,6 +482,7 @@ def sanity_check(plan, input_args):
414
482
combined_root_params = (
415
483
PARTICIPANT_CATEGORIES .keys ()
416
484
+ PARTICIPANT_MATRIX_PARAMS .keys ()
485
+ + PORT_PUBLISHER_PARAMS .keys ()
417
486
+ SUBCATEGORY_PARAMS .keys ()
418
487
+ ADDITIONAL_CATEGORY_PARAMS .keys ()
419
488
)
0 commit comments