diff --git a/Tiltfile b/Tiltfile index 9c7f6c004..eb7d986d9 100644 --- a/Tiltfile +++ b/Tiltfile @@ -39,6 +39,7 @@ config.define_string("webHost", False, "Public hostname for port forwards") # Components config.define_bool("near", False, "Enable Near component") +config.define_bool("sui", False, "Enable Sui component") config.define_bool("btc", False, "Enable BTC component") config.define_bool("aptos", False, "Enable Aptos component") config.define_bool("algorand", False, "Enable Algorand component") @@ -64,6 +65,7 @@ ci = cfg.get("ci", False) algorand = cfg.get("algorand", ci) near = cfg.get("near", ci) aptos = cfg.get("aptos", ci) +sui = cfg.get("sui", ci) evm2 = cfg.get("evm2", ci) solana = cfg.get("solana", ci) terra_classic = cfg.get("terra_classic", ci) @@ -266,6 +268,8 @@ if aptos: guardian_resource_deps = guardian_resource_deps + ["aptos"] if wormchain: guardian_resource_deps = guardian_resource_deps + ["guardian-validator"] +if sui: + guardian_resource_deps = guardian_resource_deps + ["sui"] k8s_resource( "guardian", @@ -646,6 +650,29 @@ if algorand: trigger_mode = trigger_mode, ) +if sui: + k8s_yaml_with_ns("devnet/sui-devnet.yaml") + + docker_build( + ref = "sui-node", + context = "sui", + dockerfile = "sui/Dockerfile", + ignore = ["./sui/sui.log*", "sui/sui.log*", "sui.log.*"], + only = ["Dockerfile", "scripts"], + ) + + k8s_resource( + "sui", + port_forwards = [ + port_forward(9001, name = "WS [:9001]", host = webHost), + port_forward(9002, name = "RPC [:9002]", host = webHost), + port_forward(5003, name = "Faucet [:5003]", host = webHost), + port_forward(9184, name = "Prometheus [:9184]", host = webHost), + ], +# resource_deps = ["const-gen"], + labels = ["sui"], + trigger_mode = trigger_mode, + ) if near: k8s_yaml_with_ns("devnet/near-devnet.yaml") diff --git a/devnet/sui-devnet.yaml b/devnet/sui-devnet.yaml new file mode 100644 index 000000000..d8c35c39b --- /dev/null +++ b/devnet/sui-devnet.yaml @@ -0,0 +1,65 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: sui + name: sui +spec: + ports: + - name: node + port: 9002 + targetPort: node + - name: ws + port: 9001 + targetPort: ws + - name: prometheus + port: 9184 + targetPort: prometheus + - name: faucet + port: 5003 + targetPort: faucet + selector: + app: sui +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: sui + name: sui +spec: + replicas: 1 + selector: + matchLabels: + app: sui + serviceName: sui + template: + metadata: + labels: + app: sui + spec: + containers: + - name: sui-node + image: sui-node + command: + - /bin/sh + - -c + - /tmp/start_node.sh + ports: + - containerPort: 9002 + name: node + protocol: TCP + - containerPort: 9001 + name: ws + protocol: TCP + - containerPort: 9184 + name: prometheus + protocol: TCP + - containerPort: 5003 + name: faucet + protocol: TCP + readinessProbe: + tcpSocket: + port: 9002 + + restartPolicy: Always diff --git a/sui/Docker.md b/sui/Docker.md new file mode 100644 index 000000000..414901556 --- /dev/null +++ b/sui/Docker.md @@ -0,0 +1,8 @@ +# first build the image +(cd ..; DOCKER_BUILDKIT=1 docker build --progress plain -f sui/Dockerfile.base -t sui .) +# tag the image with the appropriate version +docker tag sui:latest ghcr.io/wormhole-foundation/sui:0.15.0 +# push to ghcr +docker push ghcr.io/wormhole-foundation/sui:0.15.0 + +echo remember to update both Dockerfile and Dockerfile.export diff --git a/sui/Dockerfile b/sui/Dockerfile new file mode 100644 index 000000000..81e978a92 --- /dev/null +++ b/sui/Dockerfile @@ -0,0 +1,4 @@ +FROM ghcr.io/wormhole-foundation/sui:0.15.0@sha256:ba5740e42ac41306719114ce96d9752a12bbfa500749ede64fa76a250113993b as sui-node +RUN sui genesis -f +COPY scripts/start_node.sh /tmp +COPY scripts/funder.sh /tmp diff --git a/sui/Dockerfile.base b/sui/Dockerfile.base new file mode 100644 index 000000000..febda65a2 --- /dev/null +++ b/sui/Dockerfile.base @@ -0,0 +1,22 @@ +FROM docker.io/redhat/ubi8@sha256:56c374376a42da40f3aec753c4eab029b5ea162d70cb5f0cda24758780c31d81 as sui-node + +# RUN apt-get update && apt-get -y install libclang-dev jq cmake curl npm --no-install-recommends +RUN dnf -y update +RUN dnf -y install jq cmake curl npm git gcc openssl-devel gcc-c++ clang make git + +COPY sui/scripts/setup_rust.sh /tmp +RUN /tmp/setup_rust.sh + +WORKDIR /tmp + +COPY sui/scripts/node_builder.sh /tmp + +RUN /tmp/node_builder.sh + +WORKDIR /tmp + +FROM docker.io/redhat/ubi8@sha256:56c374376a42da40f3aec753c4eab029b5ea162d70cb5f0cda24758780c31d81 as export-stage + +COPY --from=sui-node /root/.cargo/bin/sui /bin/sui +COPY --from=sui-node /root/.cargo/bin/sui-faucet /bin/sui-faucet +COPY --from=sui-node /root/.cargo/bin/sui-node /bin/sui-node diff --git a/sui/scripts/funder.sh b/sui/scripts/funder.sh new file mode 100755 index 000000000..7c5dc6478 --- /dev/null +++ b/sui/scripts/funder.sh @@ -0,0 +1,3 @@ +#!/bin/bash -f + +sui client transfer-sui --to 0x2acab6bb0e4722e528291bc6ca4f097e18ce9331 --sui-coin-object-id `sui client objects | grep sui::SUI | tail -1 | sed -e 's/|.*//'` --gas-budget 10000 diff --git a/sui/scripts/start_node.sh b/sui/scripts/start_node.sh new file mode 100755 index 000000000..b3bc51990 --- /dev/null +++ b/sui/scripts/start_node.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -x + +sui start & +sleep 10 +#sleep infinity +sui client object --id 0x5 +#sui-faucet --host-ip 0.0.0.0& +#sleep 2 +#curl -X POST -d '{"FixedAmountRequest":{"recipient": "'"0x2acab6bb0e4722e528291bc6ca4f097e18ce9331"'"}}' -H 'Content-Type: application/json' http://127.0.0.1:5003/gas +sed -i -e 's/:9000/:9002/' ~/.sui/sui_config/fullnode.yaml +sui-node --config-path ~/.sui/sui_config/fullnode.yaml + +#sleep infinity