-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.star
85 lines (77 loc) · 2.61 KB
/
main.star
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# This Kurtosis package spins up a minimal CosmWasm rollup that connects to a DA node
#
# NOTE: currently this is only connecting to a local DA node
da_node = import_module("github.com/rollkit/local-da/[email protected]")
def run(plan):
##########
# DA
##########
da_address = da_node.run(
plan,
)
plan.print("connecting to da layer via {0}".format(da_address))
#################
# CosmWasm Rollup
#################
plan.print("Adding CosmWasm service")
rpc_port_number = 36657
grpc_port_number = 9290
p2p_port_number = 36656
wasmd_start_cmd = [
"wasmd",
"start",
"--rollkit.aggregator",
"--rollkit.da_address {0}".format(da_address),
"--rpc.laddr tcp://0.0.0.0:{0}".format(rpc_port_number),
"--grpc.address 0.0.0.0:{0}".format(grpc_port_number),
"--p2p.laddr 0.0.0.0:{0}".format(p2p_port_number),
"--minimum-gas-prices='0.025uwasm'",
]
wasmd_ports = {
"rpc-laddr": defaultPortSpec(rpc_port_number),
"grpc-addr": defaultPortSpec(grpc_port_number),
"p2p-laddr": defaultPortSpec(p2p_port_number),
}
wasm = plan.add_service(
name="wasm",
config=ServiceConfig(
# Using CosmWasm version v0.1.0
image="ghcr.io/rollkit/cosmwasm:v0.1.0",
# Use ImageBuildSpec when testing changes to Dockerfile
# image = ImageBuildSpec(
# image_name="cosmwasm",
# build_context_dir=".",
# ),
cmd=["/bin/sh", "-c", " ".join(wasmd_start_cmd)],
ports=wasmd_ports,
public_ports=wasmd_ports,
ready_conditions=ReadyCondition(
recipe=ExecRecipe(
command=[
"wasmd",
"status",
"-n",
"tcp://127.0.0.1:{0}".format(rpc_port_number),
],
extract={
"output": "fromjson | .node_info.network",
},
),
field="extract.output",
assertion="==",
target_value="localwasm",
interval="1s",
timeout="10s",
),
),
)
wasm_address = "http://{0}:{1}".format(
wasm.ip_address, wasm.ports["rpc-laddr"].number
)
plan.print("CosmWasm service is available at {0}".format(wasm_address))
def defaultPortSpec(port_number):
return PortSpec(
number=port_number,
transport_protocol="TCP",
application_protocol="http",
)