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: add dwiz parachain local #186

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
"nodes": [
{
"name": "alice",
"node_type": "validator",
"prometheus": false

"node_type": "collator",
"prometheus": false,
"provider_url": "http://127.0.0.1:8000",
"request_id": 0
},
{
"name": "bob",
Expand Down
2 changes: 1 addition & 1 deletion package_io/build-spec.star
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def create_service_for_build_spec(plan, service_name, image, build_file):
object: The created service.
"""
files = {
"/app": "configs",
"/config": "configs",
}
if build_file != None:
files["/build"] = build_file
Expand Down
4 changes: 2 additions & 2 deletions package_io/utils.star
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ def check_config_validity(plan, chain_type, relaychain, parachains):
for para in parachains:
if len(para["nodes"]) != 0:
for node in para["nodes"]:
if node["node_type"] in ["validator", "full", "collator"]:
if node["node_type"] in ["validator", "full", "collator", "conduit"]:
plan.print("config for parachain is valid")
else:
return fail("parachain node_type can be only validator/full/collator")
return fail("parachain node_type can be only validator/full/collator/conduit")

def upload_files(plan):
plan.upload_files(src = "../parachain/static_files/configs", name = "configs")
Expand Down
6 changes: 3 additions & 3 deletions parachain/node_setup.star
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run_testnet_node_with_entrypoint(plan, prometheus, image, chain_name, execut
ports = ports,
public_ports = public_ports,
files = {
"/app": "configs",
"/config": "configs",
},
entrypoint = execute_command,
)
Expand Down Expand Up @@ -86,7 +86,7 @@ def run_testnet_node_with_command(plan, prometheus, image, chain_name, execute_c
ports = ports,
public_ports = public_ports,
files = {
"/app": "configs",
"/config": "configs",
},
cmd = execute_command,
)
Expand All @@ -112,7 +112,7 @@ def spawn_parachain(plan, prometheus, image, chain_name, execute_command, build_
dict: The service details of spawned parachain node.
"""
files = {
"/app": "configs",
"/config": "configs",
}
if build_file != None:
files["/build"] = build_file
Expand Down
36 changes: 21 additions & 15 deletions parachain/parachain.star
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def start_local_parachain_node(plan, chain_type, parachain, para_id):

for node in parachain["nodes"]:
parachain_detail = {}
if "ports" in node:

if "ports" in node:
rpc_port = node["ports"]["rpc_port"]
lib2lib_port = node["ports"]["lib2lib_port"]
prometheus_port = node["ports"]["prometheus_port"] if node["prometheus"] else None
Expand All @@ -38,12 +38,19 @@ def start_local_parachain_node(plan, chain_type, parachain, para_id):
lib2lib_port = None
prometheus_port = None

exec_comexec_commandmand = [
"/bin/bash",
"-c",
"{0} --base-path=/tmp/{1} --chain=/build/{1}-raw.json --rpc-port=9946 --port=30333 --rpc-external --rpc-cors=all --prometheus-external --{2} --collator --rpc-methods=unsafe --force-authoring --execution=wasm -- --chain=/app/raw-polkadot.json --execution=wasm".format(binary, chain_name, node["name"]),
]

if node["node_type"] == "conduit":
exec_comexec_commandmand = [
"/bin/bash",
"-c",
"{0} --base-path=/tmp/{1} --chain=/build/{1}-raw.json --rpc-port=9946 --port=30333 --rpc-external --rpc-cors=all --prometheus-external --{2} --conduit --provider_url={3} --request_id={4} --rpc-methods=unsafe --force-authoring --execution=wasm -- --chain=/config/raw-polkadot.json --execution=wasm".format(binary, chain_name, node["name"], node["provider_url"], node["request_id"]),
]
else:
exec_comexec_commandmand = [
"/bin/bash",
"-c",
"{0} --base-path=/tmp/{1} --chain=/build/{1}-raw.json --rpc-port=9946 --port=30333 --rpc-external --rpc-cors=all --prometheus-external --{2} --collator --rpc-methods=unsafe --force-authoring --execution=wasm -- --chain=/config/raw-polkadot.json --execution=wasm".format(binary, chain_name, node["name"]),
]

build_file = raw_service.name
parachain_spawn_detail = node_setup.spawn_parachain(plan, node["prometheus"], image, "{0}-{1}-{2}".format(chain_name, node["name"], chain_type), exec_comexec_commandmand, build_file, rpc_port, prometheus_port, lib2lib_port)
parachain_detail["service_name"] = parachain_spawn_detail.name
Expand Down Expand Up @@ -76,13 +83,13 @@ def start_nodes(plan, chain_type, parachains, relay_chain_ip):
list: List of dictionaries containing service details of each parachain.
"""
final_parachain_details = {}

for parachain in parachains:
para_id = register_para_slot.register_para_id(plan, relay_chain_ip)
para_id = register_para_slot.register_para_id(plan, relay_chain_ip)
parachain_details = start_local_parachain_node(plan, chain_type, parachain, para_id)
register_para_slot.onboard_genesis_state_and_wasm(plan, para_id, parachain["name"], relay_chain_ip)
final_parachain_details.update(parachain_details)

return final_parachain_details

def run_testnet_mainnet(plan, chain_type, relaychain_name, parachain):
Expand Down Expand Up @@ -127,7 +134,7 @@ def run_testnet_mainnet(plan, chain_type, relaychain_name, parachain):
"--rpc-external",
"--rpc-methods=unsafe",
"--unsafe-rpc-external",
]
]

parachain_info = {parachain["name"]: {}}
if parachain["name"] == "altair" or parachain["name"] == "centrifuge":
Expand All @@ -139,16 +146,15 @@ def run_testnet_mainnet(plan, chain_type, relaychain_name, parachain):

final_parachain_info = {}
for node in parachain["nodes"]:

if "ports" in node:
if "ports" in node:
rpc_port = node["ports"]["rpc_port"]
lib2lib_port = node["ports"]["lib2lib_port"]
prometheus_port = node["ports"]["prometheus_port"] if node["prometheus"] else None
else:
rpc_port = None
lib2lib_port = None
prometheus_port = None

command = common_command
command = command + ["--name={0}".format(node["name"])]
if node["node_type"] == "collator":
Expand Down
7 changes: 6 additions & 1 deletion parachain/static_files/images.star
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ parachain_images = {
"subsocial": {
"image": "dappforce/subsocial-parachain:latest",
"entrypoint": "/usr/local/bin/subsocial-collator",
"base": ["local-rococo", "/app/soonsocial.json", ""],
"base": ["local-rococo", "/config/soonsocial.json", ""],
},
"zeitgeist": {
"image": "zeitgeistpm/zeitgeist-node-parachain:latest",
Expand Down Expand Up @@ -170,4 +170,9 @@ parachain_images = {
"entrypoint": "./oak-collator",
"base": ["turing-dev", "turing-staging", "turing"],
},
"dwiz": {
"image": "hugobyte/dwiz-parachain",
"entrypoint": "/app/dwiz-parachain-node",
"base": ["local", None, None],
},
}
Loading