Skip to content

Commit

Permalink
feat: implement kurtosis package for local setup of clover parachain (#…
Browse files Browse the repository at this point in the history
…29)

* feat: implement kurtosis package for local setup of clover parachain

* feat: implement method to run relay chains with local.config

* refactor: change port key values from port number to ws and tcp
  • Loading branch information
abhiyana authored Oct 31, 2023
1 parent 42bdf39 commit 62fd343
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 9 deletions.
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

0 comments on commit 62fd343

Please sign in to comment.