Skip to content

Commit

Permalink
feat: add helper function for sanity checking parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Ji Hwan <[email protected]>
  • Loading branch information
jhkimqd committed Feb 5, 2025
1 parent ace83c6 commit 43ff7a0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def run(plan, args={}):
if verbosity == constants.LOG_LEVEL.debug or verbosity == constants.LOG_LEVEL.trace:
plan.print("Deploying CDK stack with the following configuration: " + str(args))

# Sanity check for conflicting parameters.
plan.print("Checking for incompatible parameters...")
sanity_check(plan, deployment_stages, args, op_stack_args)

# Deploy a local L1.
if deployment_stages.get("deploy_l1", False):
plan.print("Deploying a local L1")
Expand Down Expand Up @@ -278,3 +282,12 @@ def deploy_additional_service(plan, name, package, args, contract_setup_addresse
else:
import_module(package).run(plan, service_args, contract_setup_addresses)
plan.print("Successfully launched %s" % name)


# Helper function to check for parameter combinations that will result in errors within individual services even though the deployment may succeed.
def sanity_check(plan, deployment_stages, args, op_stack_args):
# deploy_optimistic_rollup and consensus_contract_type check
if deployment_stages.get("deploy_optimism_rollup", False):
if args.get("consensus_contract_type", "cdk-validium") != "pessimistic":
plan.print("OP Stack rollup requires pessimistic consensus contract type, halting further deployment...")
return fail("Incompatible parameters")

0 comments on commit 43ff7a0

Please sign in to comment.