-
Notifications
You must be signed in to change notification settings - Fork 97
feat(supervisor): Add support for kona-supervisor
#291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
02b9617
Add support for kona-supervisor
emhane 0eab66f
Add test for kona-supervisor launcher
emhane 09ce417
Rm redundant metrics functions
emhane 92b63c6
Move image loading into function
emhane fa5c023
Fix lint
emhane dd5ada2
Set kona-supervisor image
emhane d601c69
Add registry ID for kona-supervisor
emhane 2b15449
Fix lint
emhane 25c4711
Fix whitespace
emhane ab0c903
Fix whitespace
emhane 894bd29
Fix whitespace
emhane c05ae85
fixup! Fix whitespace
emhane 0bfd93a
fixup! Fix whitespace
emhane 2ad95de
Fix lint
emhane 9a27f81
Fix lint
emhane 2283d88
Fix lint
emhane dffef4d
Fix lint
emhane 19f1ade
Fix lint
emhane 58e8e7d
Fix imports
emhane 5a8c0af
Fix broken test
emhane fbc4426
fixup! Fix broken test
emhane 2911046
Fix bugs, indexing supervsior params
emhane 513eda8
fixup! Fix bugs, indexing supervsior params
emhane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,101 @@ | ||
| _file = import_module("/src/util/file.star") | ||
| _net = import_module("/src/util/net.star") | ||
|
|
||
| _ethereum_package_constants = import_module( | ||
| "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" | ||
| ) | ||
|
|
||
| _observability = import_module("/src/observability/observability.star") | ||
| _prometheus = import_module("/src/observability/prometheus/prometheus_launcher.star") | ||
|
|
||
|
|
||
| DATA_DIR = "/etc/kona-supervisor" | ||
| DEPENDENCY_SET_FILE_NAME = "dependency_set.json" | ||
|
|
||
|
|
||
| def launch( | ||
| plan, | ||
| params, | ||
| l1_config_env_vars, | ||
| l2s, | ||
| jwt_file, | ||
| deployment_output, | ||
| observability_helper, | ||
| ): | ||
| supervisor_l2s = [ | ||
| l2 for l2 in l2s if l2.network_id in params.superchain.participants | ||
| ] | ||
|
|
||
| config = _get_config( | ||
| plan=plan, | ||
| params=params, | ||
| l1_config_env_vars=l1_config_env_vars, | ||
| l2s=supervisor_l2s, | ||
| jwt_file=jwt_file, | ||
| deployment_output=deployment_output, | ||
| observability_helper=observability_helper, | ||
| ) | ||
|
|
||
| service = plan.add_service(params.service_name, config) | ||
|
|
||
| _observability.register_op_service_metrics_job( | ||
| observability_helper, | ||
| service, | ||
| ) | ||
|
|
||
| return struct(service=service, l2s=supervisor_l2s) | ||
|
|
||
|
|
||
| def _get_config( | ||
| plan, | ||
| params, | ||
| l1_config_env_vars, | ||
| l2s, | ||
| jwt_file, | ||
| deployment_output, | ||
| observability_helper, | ||
| ): | ||
| ports = _net.ports_to_port_specs(params.ports) | ||
| datadir = params.superchain.dependency_set.name | ||
|
|
||
| cmd = ["kona-supervisor"] + params.extra_params | ||
|
|
||
| # apply customizations | ||
|
|
||
| if observability_helper.enabled: | ||
| _observability.configure_op_service_metrics(cmd, ports) | ||
|
|
||
| return ServiceConfig( | ||
| image=params.image, | ||
| ports=ports, | ||
| files={ | ||
| DATA_DIR: params.superchain.dependency_set.name, | ||
| _ethereum_package_constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: deployment_output, | ||
| _ethereum_package_constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, | ||
| }, | ||
| env_vars={ | ||
| "DATADIR": "/db", | ||
| "DEPENDENCY_SET": "{0}/{1}".format( | ||
| DATA_DIR, params.superchain.dependency_set.path | ||
| ), | ||
| "ROLLUP_CONFIG_PATHS": _ethereum_package_constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS | ||
emhane marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| + "/rollup-*.json", | ||
| "L1_RPC": l1_config_env_vars["L1_RPC_URL"], | ||
| "L2_CONSENSUS_NODES": ",".join( | ||
| [ | ||
| _net.service_url( | ||
| participant.cl_context.ip_addr, | ||
| params.superchain.ports[_net.INTEROP_RPC_PORT_NAME], | ||
| ) | ||
| for l2 in l2s | ||
| for participant in l2.participants | ||
| ] | ||
| ), | ||
| "L2_CONSENSUS_JWT_SECRET": _ethereum_package_constants.JWT_MOUNT_PATH_ON_CONTAINER, | ||
| "RPC_ADDR": "0.0.0.0", | ||
| "RPC_PORT": str(params.ports[_net.RPC_PORT_NAME].number), | ||
| "RPC_ENABLE_ADMIN": "true", | ||
emhane marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| cmd=cmd, | ||
| private_ip_address_placeholder=_ethereum_package_constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, | ||
| ) | ||
This file contains hidden or 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,37 @@ | ||
| op_supervisor_launcher = import_module("./op-supervisor/launcher.star") | ||
| kona_supervisor_launcher = import_module("./kona-supervisor/launcher.star") | ||
|
|
||
|
|
||
| def launch( | ||
| plan, | ||
| params, | ||
| l1_config_env_vars, | ||
| l2s, | ||
| jwt_file, | ||
| deployment_output, | ||
| observability_helper, | ||
| ): | ||
| supervisor_type = params.type | ||
|
|
||
| if supervisor_type == "op-supervisor": | ||
| return op_supervisor_launcher.launch( | ||
| plan=plan, | ||
| params=params, | ||
| l1_config_env_vars=l1_config_env_vars, | ||
| l2s=l2s, | ||
| jwt_file=jwt_file, | ||
| deployment_output=deployment_output, | ||
| observability_helper=observability_helper, | ||
| ) | ||
| elif supervisor_type == "kona-supervisor": | ||
| return kona_supervisor_launcher.launch( | ||
| plan=plan, | ||
| params=params, | ||
| l1_config_env_vars=l1_config_env_vars, | ||
| l2s=l2s, | ||
| jwt_file=jwt_file, | ||
| deployment_output=deployment_output, | ||
| observability_helper=observability_helper, | ||
| ) | ||
| else: | ||
| fail("Unsupported supervisor implementation {}".format(supervisor_type)) |
This file contains hidden or 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 hidden or 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,86 @@ | ||
| _kona_supervisor_launcher = import_module( | ||
| "/src/supervisor/kona-supervisor/launcher.star" | ||
| ) | ||
|
|
||
| _input_parser = import_module("/src/package_io/input_parser.star") | ||
| _observability = import_module("/src/observability/observability.star") | ||
| _ethereum_package_constants = import_module( | ||
| "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" | ||
| ) | ||
|
|
||
|
|
||
| def test_interop_kona_supervisor_ports(plan): | ||
| parsed_input_args = _input_parser.input_parser( | ||
| plan, | ||
| { | ||
| "chains": [ | ||
| { | ||
| "network_params": { | ||
| "network_id": 1000, | ||
| }, | ||
| "participants": [ | ||
| { | ||
| "el_type": "op-reth", | ||
| "el_image": "op-reth:latest", | ||
| "cl_type": "op-node", | ||
| "cl_image": "op-node:latest", | ||
| } | ||
| ], | ||
| } | ||
| ], | ||
| "superchains": {"superchain0": {}}, | ||
| "supervisors": { | ||
| "supervisor0": { | ||
| "superchain": "superchain0", | ||
| "type": "kona-supervisor", | ||
| } | ||
| }, | ||
| }, | ||
| ) | ||
|
|
||
| # Just to make sure | ||
| expect.ne(parsed_input_args.supervisors, None) | ||
|
|
||
| supervisor_params = parsed_input_args.supervisors[0] | ||
| expect.ne(supervisor_params, None) | ||
|
|
||
| observability_helper = _observability.make_helper(parsed_input_args.observability) | ||
|
|
||
| result = _kona_supervisor_launcher.launch( | ||
| plan=plan, | ||
| l1_config_env_vars={"L1_RPC_URL": "http://l1.rpc"}, | ||
| l2s=[], | ||
| jwt_file="/jwt_file", | ||
| params=supervisor_params, | ||
| deployment_output="/deployment_output", | ||
| observability_helper=observability_helper, | ||
| ) | ||
|
|
||
| service = plan.get_service(supervisor_params.service_name) | ||
| expect.ne(service, None) | ||
|
|
||
| expect.eq(service.ports["rpc"].number, 8545) | ||
| expect.eq(service.ports["rpc"].application_protocol, "http") | ||
|
|
||
| service_config = kurtosistest.get_service_config(supervisor_params.service_name) | ||
| expect.ne(service_config, None) | ||
|
|
||
| expect.eq(service_config.env_vars["RPC_ADDR"], "0.0.0.0") | ||
| expect.eq(service_config.env_vars["RPC_PORT"], "8545") | ||
|
|
||
| expect.eq( | ||
| supervisor_params.superchain.dependency_set.name, | ||
| "superchain-depset-superchain0", | ||
| ) | ||
| expect.eq( | ||
| supervisor_params.superchain.dependency_set.path, | ||
| "superchain-depset-superchain0.json", | ||
| ) | ||
| expect.eq( | ||
| service_config.env_vars["DEPENDENCY_SET"], | ||
| "/etc/kona-supervisor/superchain-depset-superchain0.json", | ||
| ) | ||
| expect.eq( | ||
| service_config.files["/etc/kona-supervisor"].artifact_names, | ||
| ["superchain-depset-superchain0"], | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.