Skip to content
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

feat: implement kurtosis package for local setup of clover parachain #29

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 7 additions & 2 deletions main.star
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
parachain = import_module("./parachain/parachain.star")
relay_chain = import_module("./relaychain/relay-chain.star")
litentry = import_module("./parachain/litentry.star")
clover = import_module("./parachain/clover.star")

def run(plan, args):
plan.upload_files(src = "./parachain/static_files/configs", name = "configs")
service_details = {"relaychains": {}, "parachains": {}}
if args["chain-type"] == "local":
relay_chain.spawn_multiple_relay(plan, 2)
litentry.run_litentry(plan)
service_details["relaychains"] = relay_chain.start_relay_chains_local(plan, args)
service_details["parachains"] = clover.run_clover(plan)

else:
relay_chain.start_relay_chain(plan, args)

return service_details
30 changes: 30 additions & 0 deletions parachain/clover.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
def run_clover(plan):
exec_command = [
"--chain=dev",
"--rpc-port=9933",
"--rpc-external",
"--rpc-cors=all",
"--rpc-methods=unsafe",
"--execution=wasm",
"--tmp",
"--unsafe-ws-external",
"--",
"--chain=/app/rococo-local.json",
"--execution=wasm"
]
clover_service_config = ServiceConfig(
image = "cloverio/clover-para:v0.1.24",
files = {
"/app":"configs"
},
ports = {
"ws": PortSpec(9944, transport_protocol="TCP"),
"tcp": PortSpec(9933, transport_protocol="TCP")
},
cmd = exec_command,
entrypoint=["/opt/clover/bin/clover"]
)

service_details = plan.add_service(name="clover-node", config=clover_service_config)

return service_details
11 changes: 5 additions & 6 deletions parachain/litentry.star
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def run_litentry(plan):
"--rpc-methods=unsafe",
"--execution=wasm",
"--tmp",
"--unsafe-ws-external",
"--",
"--chain=/app/rococo-local.json",
"--execution=wasm"
Expand All @@ -20,11 +21,9 @@ def run_litentry(plan):
"9944": PortSpec(9944, transport_protocol="TCP"),
"9933": PortSpec(9933, transport_protocol="TCP")
},
public_ports = {
"9944": PortSpec(9432, transport_protocol="TCP"),
"9933": PortSpec(9431, transport_protocol="TCP")

},
cmd = exec_command,
)
plan.add_service(name="litentry-node", config=litentry_service_config)

service_details = plan.add_service(name="litentry-node", config=litentry_service_config)

return service_details
11 changes: 10 additions & 1 deletion relaychain/relay-chain.star
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,17 @@ def spawn_multiple_relay(plan, count):
port = port + count
start_relay_chain_local(plan, list[i], port)

def start_relay_chains_local(plan, args):
relay_nodes = args["relaychain"]["nodes"]
relay_detail = {}
for node in relay_nodes:
service_details = start_relay_chain_local(plan, node["name"], node["port"])
relay_detail["relay_service_" + node["name"]] = service_details
return relay_detail

def start_relay_chain_local(plan, name, port):
exec_command = ["bin/sh", "-c", "polkadot --base-path=/data --chain=/app/rococo-local.json --validator --ws-external --rpc-external --rpc-cors=all --name=alice --{0} --rpc-methods=unsafe --execution=wasm".format(name)]
plan.add_service(
service_details = plan.add_service(
name = "polkadot-{0}".format(name),
config = ServiceConfig(
image = "parity/polkadot:v0.9.31",
Expand All @@ -42,3 +50,4 @@ def start_relay_chain_local(plan, name, port):
entrypoint = exec_command,
),
)
return service_details