Skip to content

Commit

Permalink
Add loadbalancer service type option via config, rc2 upgrade, devnet …
Browse files Browse the repository at this point in the history
…for mesh security
  • Loading branch information
Anmol1696 committed Jul 8, 2023
1 parent 4413996 commit 26fe407
Show file tree
Hide file tree
Showing 13 changed files with 140 additions and 48 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/temp-docker.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion charts/devnet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.39-rc1
version: 0.1.39-rc2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
7 changes: 6 additions & 1 deletion charts/devnet/scripts/setup_genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ echo "Update genesis.json file with updated local params"
sed -i -e "s/\"stake\"/\"$DENOM\"/g" $CHAIN_DIR/config/genesis.json
sed -i "s/\"time_iota_ms\": \".*\"/\"time_iota_ms\": \"$TIME_IOTA_MS\"/" $CHAIN_DIR/config/genesis.json

jq -r '.app_state.staking.params.unbonding_time |= "90s"' $CHAIN_DIR/config/genesis.json > /tmp/genesis.json; mv /tmp/genesis.json $CHAIN_DIR/config/genesis.json
jq -r '.app_state.staking.params.unbonding_time |= "200s"' $CHAIN_DIR/config/genesis.json > /tmp/genesis.json; mv /tmp/genesis.json $CHAIN_DIR/config/genesis.json
jq -r '.app_state.slashing.params.downtime_jail_duration |= "6s"' $CHAIN_DIR/config/genesis.json > /tmp/genesis.json; mv /tmp/genesis.json $CHAIN_DIR/config/genesis.json

# overide for non 47 sdk
Expand Down Expand Up @@ -65,4 +65,9 @@ fi
jq -r ".app_state.wasm.params.code_upload_access.permission |= \"${wasm_permission}\"" $CHAIN_DIR/config/genesis.json > /tmp/genesis.json; mv /tmp/genesis.json $CHAIN_DIR/config/genesis.json
jq -r ".app_state.wasm.params.instantiate_default_permission |= \"${wasm_permission}\"" $CHAIN_DIR/config/genesis.json > /tmp/genesis.json; mv /tmp/genesis.json $CHAIN_DIR/config/genesis.json

if [ "$CHAIN_BIN" == "meshd" ]
then
jq -r ".app_state.meshsecurity.params.epoch_length |= \"10\"" $CHAIN_DIR/config/genesis.json > /tmp/genesis.json; mv /tmp/genesis.json $CHAIN_DIR/config/genesis.json
fi

$CHAIN_BIN tendermint show-node-id
3 changes: 3 additions & 0 deletions charts/devnet/templates/chain/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ metadata:
labels:
app.kubernetes.io/name: {{ $chain.name }}-genesis
spec:
{{- if eq $.Values.service.type "ClusterIP" }}
clusterIP: None
{{- end }}
type: {{ $.Values.service.type }}
ports:
{{- range $name, $port := $portMap }}
- name: {{ $name }}
Expand Down
3 changes: 3 additions & 0 deletions charts/devnet/templates/collector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ metadata:
labels:
app.kubernetes.io/name: collector
spec:
{{- if eq $.Values.service.type "ClusterIP" }}
clusterIP: None
{{- end }}
type: {{ $.Values.service.type }}
ports:
- name: http
port: 8070
Expand Down
4 changes: 4 additions & 0 deletions charts/devnet/templates/explorer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ metadata:
labels:
app.kubernetes.io/name: explorer
spec:
{{- if eq $.Values.service.type "ClusterIP" }}
clusterIP: None
{{- end }}
type: ${{ $.Values.service.type }}
ports:
- name: http
port: 8080
Expand Down Expand Up @@ -81,6 +84,7 @@ data:
{{- if not $.Values.explorer.localhost }}
{{ $host := printf "%s-genesis.%s.svc.cluster.local" $chain.name $.Release.Namespace }}
{{- end }}
{{/*todo: chain rpc would need to be converted to external ip for service LoadBalancer*/}}
{{ $chain.name }}.json: |-
{
"chain_name": "{{ $chain.name }}",
Expand Down
3 changes: 3 additions & 0 deletions charts/devnet/templates/registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ metadata:
labels:
app.kubernetes.io/name: registry
spec:
{{- if eq $.Values.service.type "ClusterIP" }}
clusterIP: None
{{- end }}
type: {{ $.Values.service.type }}
ports:
- name: http
port: 8080
Expand Down
4 changes: 2 additions & 2 deletions charts/devnet/templates/relayers/hermes/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ data:
# Interval (in number of blocks) at which pending packets
# should be periodically cleared. A value of '0' will disable
# periodic packet clearing. [Default: 100]
clear_interval = 100
clear_interval = 50
# Whether or not to clear packets on start. [Default: false]
clear_on_start = true
# Toggle the transaction confirmation mechanism.
Expand Down Expand Up @@ -88,9 +88,9 @@ data:
key_name = "{{ $chain }}"
rpc_addr = "http://{{ $chain }}-genesis.{{ $.Release.Namespace }}.svc.cluster.local:26657"
grpc_addr = "http://{{ $chain }}-genesis.{{ $.Release.Namespace }}.svc.cluster.local:9090"
websocket_addr = "ws://{{ $chain }}-genesis.{{ $.Release.Namespace }}.svc.cluster.local:26657/websocket"
account_prefix = "{{ $fullchain.prefix }}"
gas_price = { price = 0.25, denom = "{{ $fullchain.denom }}" }
event_source = { mode = 'push', url = 'ws://{{ $chain }}-genesis.{{ $.Release.Namespace }}.svc.cluster.local:26657/websocket', batch_delay = '100ms' }
default_gas = 500000000
max_gas = 1000000000
rpc_timeout = "10s"
Expand Down
3 changes: 3 additions & 0 deletions charts/devnet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ resources:
cpu: "0.1"
memory: "100M"

service:
type: ClusterIP

exposer:
image: ghcr.io/cosmology-tech/starship/exposer:20230617-eea58bd
ports:
Expand Down
8 changes: 4 additions & 4 deletions clients/go/client/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ import (
"net/http"
"os"

coretypes "github.com/cometbft/cometbft/rpc/core/types"
"github.com/cosmos/cosmos-sdk/client/tx"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/go-bip39"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/golang/protobuf/jsonpb"
lens "github.com/strangelove-ventures/lens/client"
coretypes "github.com/cometbft/cometbft/rpc/core/types"
"go.uber.org/zap"

pb "github.com/cosmology-tech/starship/registry/registry"
)

type ChainClients []*ChainClient

func NewChainClients(logger *zap.Logger, config *Config) (ChainClients, error) {
func NewChainClients(logger *zap.Logger, config *Config, chainModuleBasic map[string][]module.AppModuleBasic) (ChainClients, error) {
var clients []*ChainClient
for _, chain := range config.Chains {
client, err := NewChainClient(logger, config, chain.Name)
Expand Down Expand Up @@ -60,7 +60,7 @@ type ChainClient struct {
Client *lens.ChainClient
}

func NewChainClient(logger *zap.Logger, config *Config, chainID string) (*ChainClient, error) {
func NewChainClient(logger *zap.Logger, config *Config, chainID string, moduleBasics []module.AppModuleBasic) (*ChainClient, error) {
cc := config.GetChain(chainID)

chainClient := &ChainClient{
Expand Down
4 changes: 2 additions & 2 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
EXAMPLE = multi-chain
EXAMPLE = mesh-security
FILE = config.yaml

HELM_REPO = starship
Expand Down Expand Up @@ -33,7 +33,7 @@ delete:

.PHOY: port-forward-all
port-forward-all:
bash $(CURDIR)/../scripts/port-forward.sh -c=$(FILE)
bash $(CURDIR)/../scripts/port-forward.sh -c=$(EXAMPLE)/$(FILE)

.PHONY: stop-forward
stop-forward:
Expand Down
50 changes: 50 additions & 0 deletions examples/mesh-security/DEVNET.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## Mesh Security Devnet

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

Chain-id: `provider`

Host: `a97f533488fe84821bb5a9272031b169-1957337260.ap-southeast-1.elb.amazonaws.com`

Endpoints:
* RPC: 26657
* Rest: 1317
* Faucet: 8000

```
Provider Contracts:
valut: mesh14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sysl6kf
externalStaking: mesh1zwv6feuzhy6a9wekh96cd57lsarmqlwxdypdsplw6zhfncqw6ftqsqwra5
nativeStaking: mesh1qg5ega6dykkxc307y25pecuufrjkxkaggkkxh7nad0vhyhtuhw3stmd2jl
```

### Consumer Chain

Chain-id: `consumer`

Host: `ad655b3f02d52426184e4580d1069e8a-833461481.ap-southeast-1.elb.amazonaws.com`

Endpoints:
* RPC: 26657
* Rest: 1317
* Faucet: 8000

```
Consumer Contracts:
staking: mesh1xr3rq8yvd7qplsw5yx90ftsr2zdhg4e9z60h5duusgxpv72hud3syz4y6d
priceFeed: mesh14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sysl6kf
converter: mesh1qg5ega6dykkxc307y25pecuufrjkxkaggkkxh7nad0vhyhtuhw3stmd2jl
```

## Chain Registry

Host: `ac7cbb684e7fd41eca0866ec659b4de2-1861589237.ap-southeast-1.elb.amazonaws.com`

Endpoints:
* Chains: `/chains/{chain-id}`
* IBC: `/ibc/{chain-1}/{chain-2}`
* Mnemonics: `/chains/{chain-id}/keys`


59 changes: 59 additions & 0 deletions examples/mesh-security/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
service:
type: LoadBalancer

chains:
- name: provider
type: custom
numValidators: 1
image: anmol1696/meshd:local
home: /root/.meshd
binary: meshd
prefix: mesh
denom: ustake
coins: 100000000000000ustake
hdPath: m/44'/118'/0'/0/0
coinType: 118
repo: https://github.com/osmosis/mesh-security-sdk
ports:
rest: 1313
rpc: 26653
faucet: 8003
resource:
cpu: 1
memory: 2Gi
- name: consumer
type: custom
numValidators: 1
image: anmol1696/meshd:local
home: /root/.meshd
binary: meshd
prefix: mesh
denom: ustake
coins: 100000000000000ustake
hdPath: m/44'/118'/0'/0/0
coinType: 118
repo: https://github.com/osmosis/mesh-security-sdk
ports:
rest: 1317
rpc: 26657
faucet: 8007
resource:
cpu: 1
memory: 2Gi

relayers:
- name: provider-consumer
type: hermes
replicas: 1
image: ghcr.io/cosmology-tech/starship/hermes:39033cdee9e7aaa2274aeca3ab152542bf93d8bd
chains:
- provider
- consumer
resource:
cpu: 1
memory: 2Gi

registry:
enabled: true
ports:
rest: 8081

0 comments on commit 26fe407

Please sign in to comment.