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

WIP: Starship integration #54

Closed
wants to merge 5 commits into from
Closed
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
11 changes: 8 additions & 3 deletions demo/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM golang:1.20-alpine AS go-builder
ARG ARCH=x86_64

RUN apk add --no-cache ca-certificates build-base git

Expand All @@ -13,7 +12,7 @@ ADD go.mod go.sum ./
RUN set -eux; \
WASM_VERSION=v$(go list -m github.com/CosmWasm/wasmvm | cut -d" " -f2 | cut -d"v" -f2); \
echo $WASM_VERSION; \
wget -O /lib/libwasmvm_muslc.a https://github.com/CosmWasm/wasmvm/releases/download/${WASM_VERSION}/libwasmvm_muslc.${ARCH}.a
wget -O /lib/libwasmvm_muslc.a https://github.com/CosmWasm/wasmvm/releases/download/${WASM_VERSION}/libwasmvm_muslc.$(uname -m).a

# Copy over code
COPY . /code
Expand All @@ -31,9 +30,15 @@ FROM alpine:3.16

COPY --from=go-builder /code/build/meshd /usr/bin/meshd

# Set up dependencies
ENV PACKAGES curl make bash jq sed

# Install minimum necessary dependencies
RUN apk add --no-cache $PACKAGES

WORKDIR /opt

# rest server, tendermint p2p, tendermint rpc
EXPOSE 1317 26656 26657

CMD ["/usr/bin/meshd", "version"]
CMD ["/usr/bin/meshd", "version"]
17 changes: 12 additions & 5 deletions demo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,25 @@ endif
build-vendored:
go build -mod=vendor $(BUILD_FLAGS) -o $(BUILD_DIR)/meshd ./cmd/meshd

build-linux-static:
docker-build:
go mod vendor # quick hack to make local dependencies work in Docker
mkdir -p $(BUILD_DIR)
docker build --tag osmosis/meshd:local ./
docker create --name meshd_temp osmosis/meshd:local
docker cp meshd_temp:/usr/bin/meshd $(BUILD_DIR)/
docker rm -f meshd_temp
docker buildx build --platform linux/amd64,linux/arm64 --tag anmol1696/meshd:local ./ --push
rm -rf vendor/

install:
go install -mod=readonly $(BUILD_FLAGS) ./cmd/meshd

########################################
### Docker

.PHONY: docker-build-linux
docker-build-linux:
docker buildx build --platform linux/amd64 --tag anmol1696/meshd:latest ./ --push

docker-build-arm64:
docker buildx build --platform linux/arm64 --build-arg ARCH=darwin --tag anmol1696/meshd:latest ./ --load

########################################
### Testing

Expand Down
69 changes: 69 additions & 0 deletions tests/starship/DEVNET.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
## Mesh Security Devnet

> NOTE: Host and smart contract address are subject to change on redeployment of the system

### Provider Chain

Chain-id: `provider`
Denom: `uosmo`

Host: `a8dbf4ded5fde419b9c068489cef72ff-704314997.ap-southeast-1.elb.amazonaws.com`

Ports:
* RPC: [26657](http://a8dbf4ded5fde419b9c068489cef72ff-704314997.ap-southeast-1.elb.amazonaws.com:26657/status)
* Rest: [1317](http://a8dbf4ded5fde419b9c068489cef72ff-704314997.ap-southeast-1.elb.amazonaws.com:1317)
* Faucet: [8000](http://a8dbf4ded5fde419b9c068489cef72ff-704314997.ap-southeast-1.elb.amazonaws.com:8000)

Get tokens from faucet
```bash
curl --header "Content-Type: application/json" \
--request POST \
--data '{"denom":"ustake","address":"mesh1yre6ac7qfgyfgvh58ph0rgw627rhw766y430qq"}' \
http://a8dbf4ded5fde419b9c068489cef72ff-704314997.ap-southeast-1.elb.amazonaws.com:8000/credit
```

```
Provider Contracts:
valut: mesh1xhcxq4fvxth2hn3msmkpftkfpw73um7s4et3lh4r8cfmumk3qsmsw3arzh
ExternalStaking: mesh1m74wv3xew5dsy2thf3jp0xadg8pdrk4h8ym70z0ehfwxl8a547asz8p7f7
nativeStaking: mesh1uvt40rsp68wtas0y75w34qdn5h0g5eyefy5gmvzftdnupyv7q7vq5jz5rv
```

### Consumer Chain

Chain-id: `consumer`
Denom: `ujuno`
Prefix: `mesh`

Host: `a98000cb656f34d12a138f0189a8ca38-543023852.ap-southeast-1.elb.amazonaws.com`

Ports:
* RPC: [26657](http://a98000cb656f34d12a138f0189a8ca38-543023852.ap-southeast-1.elb.amazonaws.com:26657/status)
* Rest: [1317](http://a98000cb656f34d12a138f0189a8ca38-543023852.ap-southeast-1.elb.amazonaws.com:1317/status)
* Faucet: [8000](http://a98000cb656f34d12a138f0189a8ca38-543023852.ap-southeast-1.elb.amazonaws.com:8000/status)

Get tokens from faucet
```bash
curl --header "Content-Type: application/json" \
--request POST \
--data '{"denom":"ustake","address":"mesh1yre6ac7qfgyfgvh58ph0rgw627rhw766y430qq"}' \
http://a98000cb656f34d12a138f0189a8ca38-543023852.ap-southeast-1.elb.amazonaws.com:8000/credit
```

```
Consumer Contracts:
Staking: mesh1fuyxwxlsgjkfjmxfthq8427dm2am3ya3cwcdr8gls29l7jadtazsvvhd03
PriceFeed: mesh13we0myxwzlpx8l5ark8elw5gj5d59dl6cjkzmt80c5q5cv5rt54qu2r0a5
Converter: mesh18yn206ypuxay79gjqv6msvd9t2y49w4fz8q7fyenx5aggj0ua37q6xkydx
```

## Chain Registry

Host: `a87656a56ccec4d06aa33db894dff957-1524822698.ap-southeast-1.elb.amazonaws.com`

Port: [8080](http://a87656a56ccec4d06aa33db894dff957-1524822698.ap-southeast-1.elb.amazonaws.com:8080/chains)

Endpoints:
* Chains: [`/chains/{chain-id}`](http://a87656a56ccec4d06aa33db894dff957-1524822698.ap-southeast-1.elb.amazonaws.com:8080/chains/provider)
* IBC: [`/ibc/{chain-1}/{chain-2}`](http://a87656a56ccec4d06aa33db894dff957-1524822698.ap-southeast-1.elb.amazonaws.com:8080/ibc/provider/consumer)
* Mnemonics: [`/chains/{chain-id}/keys`](http://a87656a56ccec4d06aa33db894dff957-1524822698.ap-southeast-1.elb.amazonaws.com:8080/chains/provider/keys)
75 changes: 75 additions & 0 deletions tests/starship/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/make -f

BUILD_DIR = ./build

all: test

test:
go test -mod=readonly -race ./...

build-setup:
go build -o build/ ./setup

run-setup:
cd setup && go run ./...

build:
CGO_ENABLED=1 go test -c -mod=readonly -o $(BUILD_DIR)/mesh-security.e2e.test

build-linux:
CGO_ENABLED=1 GOOS=linux go test -c -mod=readonly -o $(BUILD_DIR)/mesh-security.e2e.test

.PHONY: all build build-linux test

###############################################################################
### Starship Helm Charts ###
###############################################################################
NAME = mesh-security
FILE = configs/devnet.yaml

HELM_REPO = starship
HELM_CHART = devnet
HELM_VERSION = v0.1.39-rc4

.PHONY: check
setup-deps:
bash $(CURDIR)/scripts/dev-setup.sh

setup-helm:
helm repo add $(HELM_REPO) https://cosmology-tech.github.io/starship/
helm repo update
helm search repo $(HELM_REPO)/$(HELM_CHART) --version $(HELM_VERSION)

install:
helm install -f $(FILE) $(NAME) $(HELM_REPO)/$(HELM_CHART) --version $(HELM_VERSION)

debug:
helm install -f $(FILE) $(NAME) $(HELM_REPO)/$(HELM_CHART) --version $(HELM_VERSION) --dry-run --debug

delete:
-helm delete $(NAME)

###############################################################################
### Port forward ###
###############################################################################

.PHONY: port-forward
port-forward:
bash $(CURDIR)/scripts/port-forward.sh --config=$(FILE)

.PHONY: stop-forward
stop-forward:
-pkill -f "port-forward"

###############################################################################
### Local Kind Setup ###
###############################################################################
KIND_CLUSTER=starship

.PHONY: setup-kind
setup-kind:
kind create cluster --name $(KIND_CLUSTER)

.PHONY: clean-kind
clean-kind:
kind delete cluster --name $(KIND_CLUSTER)
10 changes: 10 additions & 0 deletions tests/starship/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# End-To-End Tests
Multi-chain system tests that run against the demo app.


Run them with:
```shell
make test
```


Loading
Loading