Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,31 @@ optimism_package:
image: "grafana/grafana:11.5.0"
# Interop configuration
interop:
# Whether or not to enable interop mode
# Interop can be enabled and disabled using this flag
#
# By default, interop will be enabled if there is at least one interop set specified
enabled: false
# A list of interop sets - connected L2 chains
#
# If left empty, interop is disabled
sets:
# Optional human-readable name for this interop set
- name: "interop-set-0"
# List of L2 network_ids that participate in this set
#
# Please refer to chains[].network_params.network_id for more information
participants: ["2151908"]
# Supervisor overrides for this particular interop set
#
# Leave empty to use the default supervisor configuration
supervisor_params:
# Interop set can be disabled for ease of local development
#
# Defaults to true
enabled: true
- name: "interop-set-1"
# "*" can be used to quickly add all networks into one interop set
participants: "*"
# Default supervisor configuration
supervisor_params:
# The Docker image that should be used for the supervisor; leave blank to use the default op-supervisor image
Expand Down
18 changes: 9 additions & 9 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ def run(plan, args={}):
)

if interop_params.enabled:
op_supervisor_launcher.launch(
plan,
l1_config_env_vars,
optimism_args.chains,
l2s,
jwt_file,
interop_params.supervisor_params,
observability_helper,
)
for i, interop_set in enumerate(interop_params.sets):
op_supervisor_launcher.launch(
plan=plan,
interop_set=interop_set,
l1_config_env_vars=l1_config_env_vars,
l2s=l2s,
jwt_file=jwt_file,
observability_helper=observability_helper,
)

# challenger must launch after supervisor because it depends on it for interop
for l2_num, l2 in enumerate(l2s):
Expand Down
2 changes: 1 addition & 1 deletion mise.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tools]

# Core dependencies
"ubi:ethereum-optimism/kurtosis-test" = "0.0.1"
"ubi:ethereum-optimism/kurtosis-test" = "0.0.3"
"ubi:kurtosis-tech/kurtosis-cli-release-artifacts[exe=kurtosis]" = "1.4.4"
"yq" = "v4.44.3"

Expand Down
1 change: 0 additions & 1 deletion src/interop/constants.star
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
constants = import_module("../package_io/constants.star")
util = import_module("../util.star")

INTEROP_WS_PORT_ID = "interop-ws"
Expand Down
66 changes: 46 additions & 20 deletions src/interop/op-supervisor/op_supervisor_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ ethereum_package_constants = import_module(
"github.com/ethpandaops/ethereum-package/src/package_io/constants.star"
)

constants = import_module("../../package_io/constants.star")
observability = import_module("../../observability/observability.star")
prometheus = import_module("../../observability/prometheus/prometheus_launcher.star")

constants = import_module("../../package_io/constants.star")
interop_constants = import_module("../constants.star")


Expand All @@ -30,56 +30,82 @@ DATA_DIR = "/etc/op-supervisor"
DEPENDENCY_SET_FILE_NAME = "dependency_set.json"


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


def launch(
plan,
interop_set,
l1_config_env_vars,
chains,
l2s,
jwt_file,
supervisor_params,
observability_helper,
):
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)
# First we check that the supervisor is enabled for this interop set
if not interop_set.enabled:
plan.print(
"op-supervisor is not enabled for interop set {}, skipping launch".format(
interop_set.name
)
)
return None

# Then we check that we have some participants
if len(interop_set.participants) == 0:
plan.print(
"op-supervisor has no participants for interop set {}, skipping launch".format(
interop_set.name
)
)
return None

# Now we filter out the participating L2s
interop_set_l2s = [l2 for l2 in l2s if l2.network_id in interop_set.participants]

# Now we create dependency set if none was provided
dependency_set_json = interop_set.supervisor_params.dependency_set or json.encode(
create_dependency_set(interop_set_l2s)
)

# And write it to an artifact
dependency_set_artifact = utils.write_to_file(
Comment thread
janjakubnanista marked this conversation as resolved.
plan, dependency_set_json, DATA_DIR, DEPENDENCY_SET_FILE_NAME
)

# We create a service name based on the interop set name
service_name = "{}-{}".format(
interop_constants.SUPERVISOR_SERVICE_NAME, interop_set.name
)

config = get_supervisor_config(
plan,
l1_config_env_vars,
l2s,
jwt_file,
dependency_set_artifact,
supervisor_params,
observability_helper,
plan=plan,
l1_config_env_vars=l1_config_env_vars,
l2s=interop_set_l2s,
jwt_file=jwt_file,
dependency_set_artifact=dependency_set_artifact,
supervisor_params=interop_set.supervisor_params,
observability_helper=observability_helper,
)

service = plan.add_service(interop_constants.SUPERVISOR_SERVICE_NAME, config)
service = plan.add_service(service_name, config)

observability.register_op_service_metrics_job(
observability_helper,
service,
)

return "op_supervisor"
return service


def get_supervisor_config(
Expand Down
Loading