Skip to content

Commit

Permalink
feat: generate op-supervisor dependency set json (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhwrd authored Jan 9, 2025
1 parent 2e7b7cd commit 464fbba
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ optimism_package:
# The Docker image that should be used for the supervisor; leave blank to use the default op-supervisor image
image: ""

# A JSON string containing chain dependencies
# A JSON string containing chain dependencies (generated by default).
dependency_set: ""

# A list of optional extra params that will be passed to the supervisor container for modifying its behaviour
Expand Down
1 change: 1 addition & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def run(plan, args):
op_supervisor_launcher.launch(
plan,
l1_config_env_vars,
optimism_args_with_right_defaults.chains,
all_participants,
jwt_file,
interop_params.supervisor_params,
Expand Down
22 changes: 21 additions & 1 deletion src/interop/op-supervisor/op_supervisor_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,35 @@ DATA_DIR = "/etc/op-supervisor"
DEPENDENCY_SET_FILE_NAME = "dependency_set.json"


def create_dependency_set(chains):
result = {
"dependencies": {
str(chain.network_params.network_id): {
"chainIndex": str(chain.network_params.network_id),
"activationTime": 0,
"historyMinTime": 0,
}
for chain in chains
}
}
return result


def launch(
plan,
l1_config_env_vars,
chains,
all_participants,
jwt_file,
supervisor_params,
):
dependency_set_json = supervisor_params.dependency_set
if not dependency_set_json:
dependency_set = create_dependency_set(chains)
dependency_set_json = json.encode(dependency_set)

dependency_set_artifact = utils.write_to_file(
plan, supervisor_params.dependency_set, DATA_DIR, DEPENDENCY_SET_FILE_NAME
plan, dependency_set_json, DATA_DIR, DEPENDENCY_SET_FILE_NAME
)

config = get_supervisor_config(
Expand Down

0 comments on commit 464fbba

Please sign in to comment.