diff --git a/main.star b/main.star index 1f29bb13..92470fa1 100644 --- a/main.star +++ b/main.star @@ -99,14 +99,14 @@ def run(plan, args): persistent, )) - # deploy op-supervisor - - op_supervisor_launcher.launch( - plan, - "op-supervisor", - all_participants, - optimism_args_with_right_defaults.supervisor_params, - ) + if optimism_args_with_right_defaults.interop.enabled: + # deploy op-supervisor + op_supervisor_launcher.launch( + plan, + "op-supervisor", + all_participants, + optimism_args_with_right_defaults.interop.supervisor_params, + ) return diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 2e0fb76f..d31204b4 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -51,11 +51,21 @@ def external_l1_network_params_input_parser(plan, input_args): def input_parser(plan, input_args): sanity_check.sanity_check(plan, input_args) results = parse_network_params(plan, input_args) + results["global_log_level"] = "info" results["global_node_selectors"] = {} results["global_tolerations"] = [] results["persistent"] = False + return struct( + interop=struct( + enabled=results["interop"]["enabled"], + supervisor_params=struct( + image=results["interop"]["supervisor_params"]["image"], + dependency_set=results["interop"]["supervisor_params"]["dependency_set"], + extra_params=results["interop"]["supervisor_params"]["extra_params"], + ) + ), chains=[ struct( participants=[ @@ -130,11 +140,6 @@ def input_parser(plan, input_args): "l2_artifacts_locator" ], ), - supervisor_params=struct( - image=results["supervisor_params"]["image"], - dependency_set=results["supervisor_params"]["dependency_set"], - extra_params=results["supervisor_params"]["extra_params"], - ), global_log_level=results["global_log_level"], global_node_selectors=results["global_node_selectors"], global_tolerations=results["global_tolerations"], @@ -144,6 +149,22 @@ def input_parser(plan, input_args): def parse_network_params(plan, input_args): results = {} + + # configure interop + + results["interop"] = default_interop_args() + results["interop"].update( + input_args.get("interop", {}) + ) + results["interop"]["supervisor_params"] = default_supervisor_params() + if "supervisor_params" in input_args["interop"]: + results["interop"]["supervisor_params"].update( + input_args["interop"]["supervisor_params"] + ) + + + # configure chains + chains = [] seen_names = {} @@ -239,23 +260,13 @@ def parse_network_params(plan, input_args): results["chains"] = chains - # configure supervisor - - results["supervisor_params"] = default_supervisor_params() - results["supervisor_params"].update( - input_args.get("supervisor_params", {}) - ) - - results["supervisor_params"]["image"] = ( - results["supervisor_params"]["image"] - if results["supervisor_params"]["image"] != "" - else DEFAULT_SUPERVISOR_IMAGES["op-supervisor"] - ) + # configur op-deployer results["op_contract_deployer_params"] = default_op_contract_deployer_params() results["op_contract_deployer_params"].update( input_args.get("op_contract_deployer_params", {}) ) + results["global_log_level"] = input_args.get("global_log_level", "info") return results @@ -263,6 +274,7 @@ def parse_network_params(plan, input_args): def default_optimism_args(): return { + "interop": default_interop_args(), "chains": default_chains(), "op_contract_deployer_params": default_op_contract_deployer_params(), "global_log_level": "info", @@ -271,6 +283,17 @@ def default_optimism_args(): "persistent": False, } +def default_interop_args(): + return { + "enabled": False, + } + +def default_supervisor_params(): + return { + "image": DEFAULT_SUPERVISOR_IMAGES["op-supervisor"], + "dependency_set": "", + "extra_params": [], + } def default_mev_params(): return { @@ -356,13 +379,6 @@ def default_op_contract_deployer_params(): "extra_params": [], } -def default_supervisor_params(): - return { - "image": "", - "dependency_set": "", - "extra_params": [], - } - def default_ethereum_package_network_params(): return { "network_params": { diff --git a/src/package_io/sanity_check.star b/src/package_io/sanity_check.star index b9102915..780f198a 100644 --- a/src/package_io/sanity_check.star +++ b/src/package_io/sanity_check.star @@ -1,3 +1,14 @@ +INTEROP_PARAMS = [ + "enabled", + "supervisor_params", +] + +SUPERVISOR_PARAMS = [ + "image", + "dependency_set", + "extra_params", +] + PARTICIPANT_CATEGORIES = { "participants": [ "el_type", @@ -57,21 +68,15 @@ OP_CONTRACT_DEPLOYER_PARAMS = [ "l2_artifacts_locator", ] -SUPERVISOR_PARAMS = [ - "image", - "dependency_set", - "extra_params", -] - ADDITIONAL_SERVICES_PARAMS = [ "blockscout", "rollup-boost", ] ROOT_PARAMS = [ + "interop", "chains", "op_contract_deployer_params", - "supervisor_params", "global_log_level", "global_node_selectors", "global_tolerations", @@ -87,7 +92,6 @@ EXTERNAL_L1_NETWORK_PARAMS = [ "priv_key", ] - def deep_validate_params(plan, input_args, category, allowed_params): if category in input_args: for item in input_args[category]: @@ -119,6 +123,22 @@ def sanity_check(plan, optimism_config): if key not in ROOT_PARAMS: fail("Invalid parameter {0}, allowed fields: {1}".format(key, ROOT_PARAMS)) + if "interop" in optimism_config: + validate_params( + plan, + optimism_config, + "interop", + INTEROP_PARAMS, + ) + + if "supervisor_params" in optimism_config["interop"]: + validate_params( + plan, + optimism_config["interop"], + "supervisor_params", + SUPERVISOR_PARAMS, + ) + chains = optimism_config.get("chains", []) if type(chains) != "list": @@ -171,14 +191,6 @@ def sanity_check(plan, optimism_config): OP_CONTRACT_DEPLOYER_PARAMS, ) - if "supervisor_params" in optimism_config: - validate_params( - plan, - optimism_config, - "supervisor_params", - SUPERVISOR_PARAMS, - ) - plan.print("Sanity check for OP package passed")