-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 changed file
with
73 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,30 +2,57 @@ | |
# | ||
# NOTE: currently this is only connecting to a local DA node | ||
|
||
da_node = import_module("github.com/rollkit/local-da/[email protected]") | ||
# DA Types | ||
celestia = "celestia" | ||
avail = "avail" | ||
local_da = "local-da" | ||
|
||
def run(plan): | ||
########## | ||
# DA | ||
########## | ||
|
||
da_address = da_node.run( | ||
plan, | ||
) | ||
plan.print("connecting to da layer via {0}".format(da_address)) | ||
def run(plan, da=local_da): | ||
# Define vars | ||
da_address = None | ||
da_auth_token = None | ||
|
||
# Start up the DA node | ||
plan.print("Starting up GM rollup with DA: {0}".format(da)) | ||
if da == local_da: | ||
plan.print("Using local-da") | ||
da_node = import_module("github.com/rollkit/local-da/[email protected]") | ||
da_address = da_node.run( | ||
plan, | ||
) | ||
elif da == celestia: | ||
plan.print("Using celestia for DA") | ||
da_node = import_module("github.com/MSevey/celestia-da-node-package/main.star") | ||
da_address, da_auth_token = da_node.run( | ||
plan, | ||
) | ||
else: | ||
fail("Unknown DA: {0}".format(da)) | ||
|
||
plan.print("connecting to da layer via {0}".format(da_address)) | ||
##### | ||
# GM | ||
##### | ||
|
||
plan.print("Adding GM service") | ||
plan.print("NOTE: This can take a few minutes to start up...") | ||
gm_start_cmd = [ | ||
"rollkit", | ||
"start", | ||
"--rollkit.aggregator", | ||
"--rollkit.da_address {0}".format(da_address), | ||
] | ||
gm_start_cmd = [] | ||
if da == celestia: | ||
gm_start_cmd = rollkitCMD( | ||
da, | ||
da_auth_token=da_auth_token, | ||
da_namespace="00000000000000000000000000000000000000000008e5f679bf7116cb", # Make an input, people can set this to whatever they want | ||
da_start_height=2535482, # Make an input, people can pull this from a block explorer | ||
) | ||
elif da == avail: | ||
fail("Avail DA is not yet supported") | ||
elif da == local_da: | ||
gm_start_cmd = rollkitCMD(da, da_address) | ||
else: | ||
fail("Unknown DA: {0}".format(da)) | ||
|
||
plan.print("GM start command: {0}".format(gm_start_cmd)) | ||
gm_port_number = 26657 | ||
gm_port_spec = PortSpec( | ||
number=gm_port_number, transport_protocol="TCP", application_protocol="http" | ||
|
@@ -41,7 +68,11 @@ def run(plan): | |
name="gm", | ||
config=ServiceConfig( | ||
# Using rollkit version v0.13.5 | ||
image="ghcr.io/rollkit/gm:05bd40e", | ||
# image="ghcr.io/rollkit/gm:05bd40e", | ||
image=ImageBuildSpec( | ||
image_name="gm_temp", | ||
build_context_dir=".", | ||
), | ||
cmd=["/bin/sh", "-c", " ".join(gm_start_cmd)], | ||
ports=gm_ports, | ||
public_ports=gm_ports, | ||
|
@@ -82,3 +113,29 @@ def run(plan): | |
public_ports=frontend_ports, | ||
), | ||
) | ||
|
||
|
||
def rollkitCMD( | ||
da, da_address=None, da_auth_token=None, da_namespace=None, da_start_height=None | ||
): | ||
if da == celestia: | ||
return [ | ||
"rollkit", | ||
"start", | ||
"--rollkit.aggregator", | ||
"--rollkit.da_auth_token {0}".format(da_auth_token), | ||
"--rollkit.da_namespace {0}".format(da_namespace), | ||
"--rollkit.da_start_height {0}".format(da_start_height), | ||
"--minimum-gas-price=0.025stake", | ||
] | ||
elif da == avail: | ||
fail("Avail DA is not yet supported") | ||
elif da == local_da: | ||
return [ | ||
"rollkit", | ||
"start", | ||
"--rollkit.aggregator", | ||
"--rollkit.da_address {0}".format(da_address), | ||
] | ||
else: | ||
fail("Unknown DA: {0}".format(da)) |