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

fix: parachain bloduce issue in local setup #167

Merged
merged 1 commit into from
Jan 3, 2024
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
2 changes: 2 additions & 0 deletions parachain/node_setup.star
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ def run_testnet_node_with_entrypoint(plan, image, chain_name, execute_command):
ports = {
"ws": PortSpec(9944, transport_protocol = "TCP"),
"metrics": PortSpec(9615, transport_protocol = "TCP", application_protocol = "http"),
"lib": PortSpec(30333),
},
files = {
"/app": "configs",
Expand All @@ -20,6 +21,7 @@ def run_testnet_node_with_command(plan, image, chain_name, execute_command):
ports = {
"ws": PortSpec(9944, transport_protocol = "TCP"),
"metrics": PortSpec(9615, transport_protocol = "TCP", application_protocol = "http"),
"lib": PortSpec(30333),
},
files = {
"/app": "configs",
Expand Down
37 changes: 19 additions & 18 deletions parachain/parachain.star
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ def spawn_parachain(plan, chain_name, image, command, build_file):
image = image,
files = files,
ports = {
"ws": PortSpec(9944, transport_protocol = "TCP"),
"metrics": PortSpec(9615, transport_protocol = "TCP"),
"ws": PortSpec(9944, transport_protocol = "TCP", application_protocol = "http"),
"metrics": PortSpec(9615, transport_protocol = "TCP", application_protocol = "http"),
"lib": PortSpec(30333, transport_protocol = "TCP", application_protocol = "http"),
},
entrypoint = command,
),
Expand Down Expand Up @@ -59,25 +60,25 @@ def start_local_parachain_node(plan, args, parachain_config, para_id):
chain_name = parachain
raw_service = build_spec.create_parachain_build_spec_with_para_id(plan, image, binary, chain_name, chain_base, para_id)

if parachain in constant.NO_WS_PORT:
exec_comexec_commandmand = [
"/bin/bash",
"-c",
"{0} --chain=/build/{1}-raw.json --rpc-port=9944 --rpc-external --rpc-cors=all --prometheus-external --name={1} --collator --rpc-methods=unsafe --force-authoring --execution=wasm -- --chain=/app/raw-polkadot.json --execution=wasm".format(binary, chain_name),
]
else:
exec_comexec_commandmand = [
"/bin/bash",
"-c",
"{0} --chain=/build/{1}-raw.json --ws-port=9944 --rpc-port=9933 --ws-external --rpc-external --prometheus-external --rpc-cors=all --name={1} --collator --rpc-methods=unsafe --force-authoring --execution=wasm -- --chain=/app/raw-polkadot.json --execution=wasm".format(binary, chain_name),
]
parachain_final = {}
for node in parachain_config["nodes"]:
parachain_detail = {}
parachain_spawn_detail = spawn_parachain(plan, "{0}-{1}-{2}".format(parachain, node["name"], args["chain-type"]), image, exec_comexec_commandmand, build_file = raw_service.name)
if parachain in constant.NO_WS_PORT:
exec_comexec_commandmand = [
"/bin/bash",
"-c",
"{0} --base-path=/tmp/{1} --chain=/build/{1}-raw.json --rpc-port=9944 --port=30333 --rpc-external --rpc-cors=all --prometheus-external --{2} --collator --rpc-methods=unsafe --force-authoring --execution=wasm --trie-cache-size=0 -- --chain=/app/raw-polkadot.json --execution=wasm".format(binary, chain_name, node["name"]),
]
else:
exec_comexec_commandmand = [
"/bin/bash",
"-c",
"{0} --base-path=/tmp/{1} --chain=/build/{1}-raw.json --ws-port=9944 --port=30333 --rpc-port=9933 --ws-external --rpc-external --prometheus-external --rpc-cors=all --{2} --collator --rpc-methods=unsafe --force-authoring --execution=wasm -- --chain=/app/raw-polkadot.json --execution=wasm".format(binary, chain_name, node["name"]),
]
parachain_spawn_detail = spawn_parachain(plan, "{0}-{1}-{2}".format(parachain, node["name"].lower(), args["chain-type"]), image, exec_comexec_commandmand, build_file = raw_service.name)
parachain_detail["service_name"] = parachain_spawn_detail.name
parachain_detail["endpoint"] = utils.get_service_url("ws", parachain_spawn_detail.ip_address, parachain_spawn_detail.ports["ws"].number)
parachain_detail["endpoint_prometheus"] = utils.get_service_url("tcp" , parachain_spawn_detail.ip_address, parachain_spawn_detail.ports["metrics"].number)
parachain_detail["endpoint_prometheus"] = utils.get_service_url("tcp", parachain_spawn_detail.ip_address, parachain_spawn_detail.ports["metrics"].number)
parachain_detail["service_name"] = parachain_spawn_detail.name
parachain_detail["prometheus_port"] = parachain_spawn_detail.ports["metrics"].number
parachain_detail["ip_address"] = parachain_spawn_detail.ip_address
Expand Down Expand Up @@ -197,7 +198,7 @@ def run_testnet_mainnet(plan, parachain, args):
node_details = node_setup.run_testnet_node_with_entrypoint(plan, image, "{0}-{1}-{2}".format(parachain["name"], node["name"], args["chain-type"]), command)
node_info["service_name"] = node_details.name
node_info["endpoint"] = utils.get_service_url("ws", node_details.ip_address, node_details.ports["ws"].number)
node_info["endpoint_prometheus"] = utils.get_service_url("tcp" , node_details.ip_address, node_details.ports["metrics"].number)
node_info["endpoint_prometheus"] = utils.get_service_url("tcp", node_details.ip_address, node_details.ports["metrics"].number)
node_info["service_name"] = node_details.name
node_info["ip_address"] = node_details.ip_address
node_info["prometheus_port"] = node_details.ports["metrics"].number
Expand All @@ -210,7 +211,7 @@ def run_testnet_mainnet(plan, parachain, args):
node_details = node_setup.run_testnet_node_with_command(plan, image, "{0}-{1}-{2}".format(parachain["name"], node["name"], args["chain-type"]), command)
node_info["service_name"] = node_details.name
node_info["endpoint"] = utils.get_service_url("ws", node_details.ip_address, node_details.ports["ws"].number)
node_info["endpoint_prometheus"] = utils.get_service_url("tcp" , node_details.ip_address, node_details.ports["metrics"].number)
node_info["endpoint_prometheus"] = utils.get_service_url("tcp", node_details.ip_address, node_details.ports["metrics"].number)
node_info["service_name"] = node_details.name
node_info["ip_address"] = node_details.ip_address
node_info["prometheus_port"] = node_details.ports["metrics"].number
Expand Down
3 changes: 2 additions & 1 deletion relaychain/relay-chain.star
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def start_relay_chain_local(plan, args, name):
Returns:
object: Service details of the started relay chain node.
"""
exec_command = ["bin/sh", "-c", "polkadot --base-path=/data --chain=/app/raw-polkadot.json --validator --rpc-external --rpc-cors=all --name=alice --{0} --rpc-methods=unsafe --execution=wasm --prometheus-external --insecure-validator-i-know-what-i-do".format(name)]
exec_command = ["bin/sh", "-c", "polkadot --base-path=/data --chain=/app/raw-polkadot.json --validator --rpc-external --port=30333 --rpc-cors=all --name=alice --{0} --rpc-methods=unsafe --execution=wasm --prometheus-external --insecure-validator-i-know-what-i-do".format(name)]
service_details = plan.add_service(
name = "{0}-{1}".format(args["relaychain"]["name"], name),
config = ServiceConfig(
Expand All @@ -134,6 +134,7 @@ def start_relay_chain_local(plan, args, name):
ports = {
"ws": PortSpec(9944, transport_protocol = "TCP"),
"metrics": PortSpec(9615, transport_protocol = "TCP"),
"lib2lib": PortSpec(30333, transport_protocol = "TCP"),
},
entrypoint = exec_command,
),
Expand Down