forked from ethpandaops/optimism-package
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
297 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,76 @@ | ||
shared_utils = import_module( | ||
"github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star" | ||
) | ||
constants = import_module( | ||
"github.com/ethpandaops/ethereum-package/src/package_io/constants.star" | ||
) | ||
|
||
# Port IDs | ||
DA_SERVER_HTTP_PORT_ID = "http" | ||
|
||
# Port nums | ||
DA_SERVER_HTTP_PORT_NUM = 3100 | ||
|
||
|
||
def get_used_ports(): | ||
used_ports = { | ||
DA_SERVER_HTTP_PORT_ID: shared_utils.new_port_spec( | ||
DA_SERVER_HTTP_PORT_NUM, | ||
shared_utils.TCP_PROTOCOL, | ||
shared_utils.HTTP_APPLICATION_PROTOCOL, | ||
), | ||
} | ||
return used_ports | ||
|
||
|
||
def launch_da_server( | ||
plan, | ||
service_name, | ||
image, | ||
cmd, | ||
): | ||
config = get_da_server_config( | ||
plan, | ||
service_name, | ||
image, | ||
cmd, | ||
) | ||
|
||
da_server_service = plan.add_service(service_name, config) | ||
|
||
http_url = "http://{0}:{1}".format( | ||
da_server_service.ip_address, DA_SERVER_HTTP_PORT_NUM | ||
) | ||
# da_server_context is passed as argument to op-batcher and op-node(s) | ||
return new_da_server_context( | ||
http_url=http_url, | ||
) | ||
|
||
|
||
def get_da_server_config( | ||
plan, | ||
service_name, | ||
image, | ||
cmd, | ||
): | ||
ports = get_used_ports() | ||
|
||
return ServiceConfig( | ||
image=image, | ||
ports=ports, | ||
cmd=cmd, | ||
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, | ||
) | ||
|
||
|
||
def disabled_da_server_context(): | ||
return new_da_server_context( | ||
http_url="", | ||
) | ||
|
||
|
||
def new_da_server_context(http_url): | ||
return struct( | ||
enabled=http_url != "", | ||
http_url=http_url, | ||
) |
This file contains 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 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 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 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 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 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
Oops, something went wrong.