-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement the kurtosis package for deployment of chopstick netw…
…ork (#119) Co-authored-by: Shreyas S Bhat <[email protected]>
- Loading branch information
1 parent
12e55b5
commit 8252d03
Showing
1 changed file
with
58 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
""" | ||
This package contains code for spawning the chopstick network. | ||
""" | ||
|
||
def run_chopsticks_parachain(plan, para_chain): | ||
""" | ||
Set up a service for the chopstick network for given parachain. | ||
Args: | ||
plan: The Kurtosis plan. | ||
para_chain (str): The parachain to configure for the chopstick network. | ||
""" | ||
|
||
service_config = ServiceConfig( | ||
image="node:latest", | ||
ports={ | ||
"TCP": PortSpec(number=8000) | ||
}, | ||
public_ports={ | ||
"TCP": PortSpec(number=8000) | ||
}, | ||
entrypoint=["/bin/sh", "-c", "yarn add @acala-network/chopsticks@latest && npx @acala-network/chopsticks --config=%s --port=8000" % (para_chain)] | ||
) | ||
|
||
plan.add_service(name="chopstick-", config=service_config) | ||
|
||
|
||
def run_chopsticks_xcm(plan, relay_chain, para_chains): | ||
""" | ||
Set up a service for the chopstick network with cross-chain messaging (xcm) support with give relachain and parachains. | ||
Args: | ||
plan: The Kurtosis plan. | ||
relay_chain (str): The relay chain for cross-chain messaging. | ||
para_chains (list): List of parachains to include in the network. | ||
""" | ||
|
||
exec_cmd = "npx @acala-network/chopsticks xcm" | ||
exec_cmd = exec_cmd + " -r " + relay_chain | ||
|
||
for para in para_chains: | ||
exec_cmd = exec_cmd + " -p " + para | ||
|
||
ports = {} | ||
public_ports = {} | ||
|
||
for i in range(0, len(para_chains) + 1): | ||
ports["TCP" + str(i)] = PortSpec(number=8000 + i) | ||
public_ports["TCP" + str(i)] = PortSpec(number=8000 + i) | ||
|
||
service_config = ServiceConfig( | ||
image="node:latest", | ||
ports=ports, | ||
public_ports=public_ports, | ||
entrypoint=["/bin/sh", "-c", "yarn add @acala-network/chopsticks@latest && %s" % (exec_cmd)] | ||
) | ||
|
||
plan.add_service(name="chopstick-", config=service_config) |