-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fba71dd
commit ceaa9a9
Showing
13 changed files
with
97 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
optimism_package: | ||
- participants: | ||
- el_type: op-geth | ||
network_params: | ||
- network_params: | ||
name: op-rollup-one | ||
network_id: '3151909' | ||
additional_services: [] | ||
- participants: | ||
- el_type: op-geth | ||
network_params: | ||
- network_params: | ||
name: op-rollup-two | ||
network_id: '3151910' | ||
additional_services: [] | ||
ethereum_package: | ||
participants: | ||
- el_type: geth | ||
- el_type: reth | ||
network_params: | ||
preset: minimal | ||
additional_services: | ||
- dora |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
optimism_package: | ||
participants: | ||
- count: 2 | ||
ethereum_package: | ||
participants: | ||
- el_type: geth | ||
- el_type: reth | ||
network_params: | ||
preset: minimal | ||
additional_services: | ||
- dora |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
PARTICIPANT_CATEGORIES = { | ||
"participants": [ | ||
"el_type", | ||
"el_image", | ||
"cl_type", | ||
"cl_image", | ||
"count", | ||
], | ||
} | ||
|
||
SUBCATEGORY_PARAMS = { | ||
"network_params": [ | ||
"network", | ||
"network_id", | ||
"seconds_per_slot", | ||
"name", | ||
], | ||
} | ||
|
||
ADDITIONAL_SERVICES_PARAMS = [ | ||
"blockscout", | ||
] | ||
|
||
|
||
def deep_validate_params(plan, input_args, category, allowed_params): | ||
if category in input_args: | ||
for item in input_args[category]: | ||
for param in item.keys(): | ||
if param not in allowed_params: | ||
fail( | ||
"Invalid parameter {0} for {1}. Allowed fields: {2}".format( | ||
param, category, allowed_params | ||
) | ||
) | ||
|
||
|
||
def validate_params(plan, input_args, category, allowed_params): | ||
if category in input_args: | ||
for param in input_args[category].keys(): | ||
if param not in allowed_params: | ||
fail( | ||
"Invalid parameter {0} for {1}. Allowed fields: {2}".format( | ||
param, category, allowed_params | ||
) | ||
) | ||
|
||
|
||
def sanity_check(plan, input_args): | ||
# Checks participants | ||
deep_validate_params( | ||
plan, input_args, "participants", PARTICIPANT_CATEGORIES["participants"] | ||
) | ||
|
||
# Checks additional_services | ||
if "additional_services" in input_args: | ||
for additional_services in input_args["additional_services"]: | ||
if additional_services not in ADDITIONAL_SERVICES_PARAMS: | ||
fail( | ||
"Invalid additional_services {0}, allowed fields: {1}".format( | ||
additional_services, ADDITIONAL_SERVICES_PARAMS | ||
) | ||
) | ||
|
||
# Checks subcategories | ||
for subcategories in SUBCATEGORY_PARAMS.keys(): | ||
validate_params( | ||
plan, input_args, subcategories, SUBCATEGORY_PARAMS[subcategories] | ||
) | ||
# Checks everything else | ||
for param in input_args.keys(): | ||
combined_root_params = PARTICIPANT_CATEGORIES.keys() + SUBCATEGORY_PARAMS.keys() | ||
combined_root_params.append("additional_services") | ||
|
||
if param not in combined_root_params: | ||
fail( | ||
"Invalid parameter {0}, allowed fields {1}".format( | ||
param, combined_root_params | ||
) | ||
) | ||
|
||
# If everything passes, print a message | ||
plan.print("Sanity check for OP package passed") |