Skip to content

Commit

Permalink
commet mock support (#265)
Browse files Browse the repository at this point in the history
* initial implementation start of cometmock

* some more work on comet-mock integration

* some more stuff

* some more updates, registry not working due to rpc not working for same node

* try out 2 node cometmock

* add service for getting in touch with validator nodes

* get cometmock support working, test out rest

* update support for relayer

* revert changes to relayers

* update one chain cometmock test

* add cometmock tests to run on pr and e2e

* perform cometmock port-forward to rpc endpoint of cometmock if defined

* run single node in pr test for cometmock

* update one-chain-cometmock resources

* remove faucet port

* remove rest endpoint

* update starship-action version, add starship-cli version

* Add cometmok section in the docs
  • Loading branch information
Anmol1696 committed Oct 16, 2023
1 parent fe9f1b0 commit b0b68af
Show file tree
Hide file tree
Showing 24 changed files with 478 additions and 67 deletions.
3 changes: 2 additions & 1 deletion .github/actions/e2e-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ runs:

- name: Setup Test infra
id: starship-action
uses: cosmology-tech/starship-action@b46819af977a0cb979991c9cb3633bbb7e50f1c9
uses: cosmology-tech/starship-action@18673a27a59847c27659c8e7c8efa1766fe21a50
with:
values: ${{ env.CONFIG_FILE }}
port-forward: true
version: 0.0.0
chart: ./charts/devnet
kubeconfig: ${{ steps.kubeconfig.outputs.content }}
cli-version: 42031163298cc2ef648cd7d01eb16be92f91f97d

- name: Run tests
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
- "evmos.yaml"
- "one-chain-starship-faucet.yaml"
- "multi-validator-starship-faucet.yaml"
- "one-chain-cometmock.yaml"
- "two-chain-cometmock.yaml"
- "neutron.yaml"
fail-fast: true
max-parallel: 1
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr-e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
- "evmos.yaml"
- "one-chain-starship-faucet.yaml"
- "multi-validator-starship-faucet.yaml"
- "one-chain-cometmock.yaml"
- "two-chain-cometmock.yaml"
- "neutron.yaml"
fail-fast: true
max-parallel: 1
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pr-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- "simapp.yaml"
- "one-chain-starship-faucet.yaml"
- "multi-validator-starship-faucet.yaml"
- "one-chain-cometmock.yaml"
fail-fast: true
max-parallel: 3

Expand All @@ -43,12 +44,13 @@ jobs:

- name: Setup Test infra
id: starship-action
uses: cosmology-tech/starship-action@b46819af977a0cb979991c9cb3633bbb7e50f1c9
uses: cosmology-tech/starship-action@18673a27a59847c27659c8e7c8efa1766fe21a50
with:
values: ${{ env.CONFIG_FILE }}
port-forward: true
version: 0.0.0
chart: ./charts/devnet
cli-version: 42031163298cc2ef648cd7d01eb16be92f91f97d

- name: Run tests
run: |
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/smoke-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ jobs:

- name: Setup Test infra
id: starship-action
uses: cosmology-tech/starship-action@b46819af977a0cb979991c9cb3633bbb7e50f1c9
uses: cosmology-tech/starship-action@18673a27a59847c27659c8e7c8efa1766fe21a50
with:
values: ${{ env.CONFIG_FILE }}
port-forward: true
version: 0.0.0
chart: ./charts/devnet
timeout: 10m
cli-version: 42031163298cc2ef648cd7d01eb16be92f91f97d

# todo: change this to be post step of the action
- name: Cleanup cluster
Expand Down Expand Up @@ -66,13 +67,14 @@ jobs:

- name: Setup Test infra
id: starship-action
uses: cosmology-tech/starship-action@b46819af977a0cb979991c9cb3633bbb7e50f1c9
uses: cosmology-tech/starship-action@18673a27a59847c27659c8e7c8efa1766fe21a50
with:
values: ${{ env.CONFIG_FILE }}
port-forward: true
version: 0.0.0
chart: ./charts/devnet
timeout: 10m
cli-version: 42031163298cc2ef648cd7d01eb16be92f91f97d

# todo: change this to be post step of the action
- name: Cleanup cluster
Expand Down Expand Up @@ -103,13 +105,14 @@ jobs:

- name: Setup Test infra
id: starship-action
uses: cosmology-tech/starship-action@b46819af977a0cb979991c9cb3633bbb7e50f1c9
uses: cosmology-tech/starship-action@18673a27a59847c27659c8e7c8efa1766fe21a50
with:
values: ${{ env.CONFIG_FILE }}
port-forward: true
version: 0.0.0
chart: ./charts/devnet
timeout: 10m
cli-version: 42031163298cc2ef648cd7d01eb16be92f91f97d

# todo: change this to be post step of the action
- name: Cleanup cluster
Expand Down
3 changes: 3 additions & 0 deletions charts/devnet/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -735,3 +735,6 @@ defaultFaucet:
starship:
image: ghcr.io/cosmology-tech/starship/faucet:20230915-d75e5fd
concurrency: 5

defaultCometmock:
image: ghcr.io/informalsystems/cometmock:v0.37.x
21 changes: 14 additions & 7 deletions charts/devnet/scripts/default/create-validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ DENOM="${DENOM:=uosmo}"
CHAIN_BIN="${CHAIN_BIN:=osmosisd}"
KEYS_CONFIG="${KEYS_CONFIG:=configs/keys.json}"
VAL_NAME="${VAL_NAME:=osmosis}"
NODE_URL="${NODE_URL:=http://0.0.0.0:26657}"
NODE_ARGS="${NODE_ARGS}"
GAS="${GAS:=auto}"

set -eux

# Wait for the node to be synced
max_tries=10
while [[ $($CHAIN_BIN status 2>&1 | jq ".SyncInfo.catching_up") == true ]]
while [[ $($CHAIN_BIN status --output json --node $NODE_URL 2>&1 | jq ".SyncInfo.catching_up") == true ]]
do
if [[ max_tries -lt 0 ]]; then echo "Not able to sync with genesis node"; exit 1; fi
echo "Still syncing... Sleeping for 15 secs. Tries left $max_tries"
Expand Down Expand Up @@ -37,7 +40,7 @@ is_greater() {
function cosmos-sdk-version-v50() {
# Content for the validator.json file
json_content='{
"pubkey": '$($CHAIN_BIN tendermint show-validator)',
"pubkey": '$($CHAIN_BIN tendermint show-validator $NODE_ARGS)',
"amount": "5000000000'$DENOM'",
"moniker": "'$VAL_NAME'",
"commission-rate": "0.1",
Expand All @@ -51,12 +54,14 @@ function cosmos-sdk-version-v50() {
# Run create validator tx command
echo "Running txn for create-validator"
$CHAIN_BIN tx staking create-validator /validator.json \
--node $NODE_URL \
--chain-id $CHAIN_ID \
--from $VAL_NAME \
--fees 100000$DENOM \
--keyring-backend="test" \
--gas="auto" \
--gas-adjustment 1.5 --yes > /validator.log
--output json \
--gas $GAS \
--gas-adjustment 1.5 $NODE_ARGS --yes > /validator.log

cat /validator.log | jq
}
Expand All @@ -65,7 +70,8 @@ function cosmos-sdk-version-default() {
# Run create validator tx command
echo "Running txn for create-validator"
$CHAIN_BIN tx staking create-validator \
--pubkey=$($CHAIN_BIN tendermint show-validator) \
--node $NODE_URL \
--pubkey=$($CHAIN_BIN tendermint show-validator $NODE_ARGS) \
--moniker $VAL_NAME \
--amount 5000000000$DENOM \
--chain-id $CHAIN_ID \
Expand All @@ -76,8 +82,9 @@ function cosmos-sdk-version-default() {
--min-self-delegation="1000000" \
--keyring-backend="test" \
--fees 100000$DENOM \
--gas="auto" \
--gas-adjustment 1.5 --yes > /validator.log
--gas $GAS \
--output json \
--gas-adjustment 1.5 $NODE_ARGS --yes > /validator.log

cat /validator.log | jq
}
Expand Down
7 changes: 7 additions & 0 deletions charts/devnet/templates/_chains.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ Usage:
{{ $_ = set $chain "upgrade" (dict "enabled" false) }}
{{- end }}

{{- $cometmock := get $chain "cometmock" | default (dict "enabled" false) -}}
{{- if $cometmock.enabled }}
{{- $defaultCometmock := get $defaultFile "defaultCometmock" | default dict -}}
{{- $cometmock = merge $cometmock $defaultCometmock -}}
{{- end }}
{{ $_ = set $chain "cometmock" $cometmock }}

{{- if not (hasKey $chain "build")}}
{{ $_ = set $chain "build" (dict "enabled" false) }}
{{- end }}
Expand Down
45 changes: 2 additions & 43 deletions charts/devnet/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ Usage:
- |
{{- range $chain := .chains }}
while [ $(curl -sw '%{http_code}' http://{{ include "devnet.chain.name" $chain }}-genesis.$NAMESPACE.svc.cluster.local:$GENESIS_PORT/node_id -o /dev/null) -ne 200 ]; do
echo "Genesis validator does not seem to be ready. Waiting for it to start..."
echo "Genesis validator does not seem to be ready for: {{ $chain }}. Waiting for it to start..."
echo "Checking: http://{{ include "devnet.chain.name" $chain }}-genesis.$NAMESPACE.svc.cluster.local:$GENESIS_PORT/node_id"
sleep 10;
done
{{- end }}
Expand Down Expand Up @@ -278,45 +279,3 @@ Usage:
{{- $tag := regexFind "[^:]+$" . -}}
{{ $tag }}
{{- end -}}

{{/*
Given a chain name, create a fullchain dict and return
Usage:
{{ include "devnet.fullchain" (dict "name" cosmoshub-4 "file" $.File "context" $) }}
*/}}
{{- define "devnet.getchain" -}}
{{- $defaultFile := $.file -}}
{{- required "default file must have setup" $defaultFile.defaultChains -}}
{{- $chain := dict -}}
{{- range $chainIter := $.context.Values.chains -}}
{{- if eq $chainIter.name $.name -}}
{{- $chain = $chainIter | deepCopy -}}
{{- end }}
{{- end }}
{{- required "chain need to exist" $chain.type -}}

{{- $defaultChain := get $defaultFile.defaultChains $chain.type | default dict -}}

{{/* merge defaultChain values into the $chain dict*/}}
{{- $chain = merge $chain $defaultChain -}}

{{- $faucet := get $chain "faucet" | default dict -}}
{{- $faucet = mergeOverwrite ($.context.Values.faucet | deepCopy) $faucet -}}
{{- $defaultFaucet := get $defaultFile.defaultFaucet $faucet.type | default dict -}}
{{- $faucet = merge $faucet $defaultFaucet -}}
{{ $_ := set $chain "faucet" $faucet -}}

{{- $upgrade := $chain.upgrade | default (dict "enabled" false) -}}
{{- $build := .build | default (dict "enabled" false) -}}
{{- $toBuild := or $build.enabled $upgrade.enabled -}}
{{- $_ = set $chain "toBuild" $toBuild -}}
{{- if $toBuild -}}
{{- $_ = set $chain "image" "ghcr.io/cosmology-tech/starship/runner:latest" -}}
{{- end }}
{{ println "@return" }}
{{ mustToJson $chain }}
{{- end -}}

{{- define "devnet.fullchain"}}
{{ index (splitList "@return\n" (include "devnet.getchain" .)) 1 }}
{{- end }}
Loading

0 comments on commit b0b68af

Please sign in to comment.