From 3a4a450e86ea70dd4c1da103aec24bcc21814f02 Mon Sep 17 00:00:00 2001 From: Anmol Date: Mon, 9 Oct 2023 12:43:18 +0300 Subject: [PATCH] feature: faucet-less setup (#262) * add feature to handle manual key addition as part of gentx if faucet is disabled * fix num of keys test * update exposer keys test * add more delay, update make command to not cache * add random address per chain instead of getting address from on chain addresses * add custom addresses as osmosis addrs * add docs around what happens when faucet is disabled --- charts/devnet/configs/all_keys.json | 175 ------------------ charts/devnet/configs/keys.json | 26 +-- charts/devnet/scripts/create-genesis.sh | 26 ++- charts/devnet/scripts/transfer-tokens.sh | 7 + .../templates/chains/cosmos/genesis.yaml | 6 + .../templates/chains/cosmos/validator.yaml | 29 ++- .../relayers/go-relayer/statefulset.yaml | 7 +- .../relayers/hermes/statefulset.yaml | 7 +- .../relayers/ts-relayer/statefulset.yaml | 6 +- docs/pages/config/chains.mdx | 3 + tests/e2e/Makefile | 2 +- tests/e2e/address.go | 44 +++++ tests/e2e/configs/two-chain.yaml | 3 +- tests/e2e/exposer_test.go | 4 +- tests/e2e/faucet_test.go | 7 +- tests/e2e/registry_test.go | 4 +- 16 files changed, 124 insertions(+), 232 deletions(-) delete mode 100644 charts/devnet/configs/all_keys.json create mode 100644 tests/e2e/address.go diff --git a/charts/devnet/configs/all_keys.json b/charts/devnet/configs/all_keys.json deleted file mode 100644 index 0bd2647e8..000000000 --- a/charts/devnet/configs/all_keys.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "genesis": [ - { - "name": "val0", - "type": "local", - "mnemonic": "razor dog gown public private couple ecology paper flee connect local robot diamond stay rude join sound win ribbon soup kidney glass robot vehicle" - } - ], - "validators": [ - { - "name": "val1", - "type": "local", - "mnemonic": "issue have volume expire shoe year finish poem alien urban license undo rural endless food host opera fix forum crack wide example firm learn" - }, - { - "name": "val2", - "type": "local", - "mnemonic": "broccoli robot upon blush rabbit squeeze fruit still lady antique detect can spice clay magic monster zebra solution dry salute stay wet arena matrix" - }, - { - "name": "val3", - "type": "local", - "mnemonic": "tornado modify spring arm title double bulk other recall decide table fun caught buyer bring once knife sphere arctic text zoo swim visual patient" - }, - { - "name": "val4", - "type": "local", - "mnemonic": "warm marine rent lift siege tool artwork home curious film blade trophy flush angry exact athlete edge combine weasel hour marriage grocery lake famous" - }, - { - "name": "val5", - "type": "local", - "mnemonic": "album rely rack torch eye leopard position pumpkin foil salmon intact path near apart whale arrange immense stove bright cook border hunt mail spike" - }, - { - "name": "val6", - "type": "local", - "mnemonic": "blouse task clinic dumb symbol clean dragon royal theory ill loyal human dream cement brown venture fury wild clog aunt welcome exotic radio diet" - }, - { - "name": "val7", - "type": "local", - "mnemonic": "faculty eagle pause trash punch grit valley chair digital group forward scrap answer boss opinion sock thought issue derive color survey track ritual ring" - }, - { - "name": "val8", - "type": "local", - "mnemonic": "party potato master immune current report venture lunch ring year quit diamond crowd ensure hammer nurse gym husband flat all drama lobster misery pepper" - }, - { - "name": "val9", - "type": "local", - "mnemonic": "top burden step elbow hint song swing vacuum someone intact crew actual rent belt ignore misery hybrid amount number move park between robust enable" - }, - { - "name": "val10", - "type": "local", - "mnemonic": "seat license entire dice vendor bone skull build silent path sauce price spare anchor endless guess crush sunny please estate divide energy hour unfair" - } - ], - "keys": [ - { - "name": "test1", - "type": "local", - "mnemonic": "opinion knife other balcony surge more bamboo canoe romance ask argue teach anxiety adjust spike mystery wolf alone torch tail six decide wash alley" - }, - { - "name": "test2", - "type": "local", - "mnemonic": "logic help only text door wealth hurt always remove glory viable income agent olive trial female couch old offer crash menu zero pencil thrive" - }, - { - "name": "test3", - "type": "local", - "mnemonic": "middle weather hip ghost quick oxygen awful library broken chicken tackle animal crunch appear fee indoor fitness enough orphan trend tackle faint eyebrow all" - }, - { - "name": "test4", - "type": "local", - "mnemonic": "tag apart multiply food bleak isolate describe stand guide field session design cable combine excess shrug abuse pause course ketchup umbrella program labor ripple" - }, - { - "name": "test5", - "type": "local", - "mnemonic": "pyramid gesture seminar nasty transfer problem october siege history clump tragic view heavy armor advice sand hybrid nothing acid silly hello canvas defense sand" - }, - { - "name": "test6", - "type": "local", - "mnemonic": "youth gift where between bid dose gentle seek welcome dolphin zero clump move warm weapon race target consider myself marriage range reveal diesel chase" - }, - { - "name": "test7", - "type": "local", - "mnemonic": "effort zoo raccoon bag index steak syrup rebuild test noble erupt adjust glimpse expose twist island yellow voyage potato kingdom tray theme market boss" - }, - { - "name": "test8", - "type": "local", - "mnemonic": "refuse rich mosquito help grace meat casino web order segment open grain cup awake steak collect kind valid pyramid excess other awesome few search" - }, - { - "name": "test9", - "type": "local", - "mnemonic": "month brown enter gossip panda bike bid base mimic armor gather sign office useless wine leisure electric voyage cancel february begin video total rude" - }, - { - "name": "test10", - "type": "local", - "mnemonic": "birth tool ring metal topple pottery dinner later digital shoe buffalo despair year broom toe when skirt brain advance fever sea twelve whisper dish" - } - ], - "relayers": [ - { - "name": "rly1", - "type": "local", - "mnemonic": "pen quit web pill hunt hobby tonight base wine black era cereal veteran trouble december method diet orbit copper nephew into badge olympic repair" - }, - { - "name": "rly2", - "type": "local", - "mnemonic": "rally area annual range egg solid paper kick cabbage relax grow ginger axis tone penalty swing marine endless vendor dinner guilt echo stable system" - }, - { - "name": "rly3", - "type": "local", - "mnemonic": "arena elevator helmet truly pencil early balcony aim flash dawn weather noble machine wear exile snow vast armor spring collect spy glue nuclear scrub" - }, - { - "name": "rly4", - "type": "local", - "mnemonic": "giraffe whale loan lizard prosper across lawsuit call behind round magic symptom plunge dress because object people people drama awesome inhale appear shed ocean" - }, - { - "name": "rly5", - "type": "local", - "mnemonic": "north delay present draw sausage mystery vendor series blast universe move burger pull antique offer hole question maze scrub object much away champion frozen" - }, - { - "name": "rly6", - "type": "local", - "mnemonic": "measure limb bird ridge crash switch virtual flight various forward inhale treat pluck squirrel foot vanish twice shiver clump code brain plunge clean plunge" - }, - { - "name": "rly7", - "type": "local", - "mnemonic": "evoke beach maze quote ghost sail empty coffee domain garden gorilla seek tell tenant copper this chronic loud winner impulse crew deposit cradle dignity" - }, - { - "name": "rly8", - "type": "local", - "mnemonic": "corn text lift garden option hedgehog mimic glance inspire crush rug degree language video pool tower roof share soda depart sock convince display option" - }, - { - "name": "rly9", - "type": "local", - "mnemonic": "burger cake luggage flip hazard humor across strong either enter equip box woman almost steel mobile avocado cherry radar hard author learn top spend" - }, - { - "name": "rly10", - "type": "local", - "mnemonic": "answer twin lunch tourist army guard feature tuna sign junk thunder inch post penalty hotel express rocket cabbage reduce patient anchor pony finish method" - }, - { - "name": "rly11", - "type": "local", - "mnemonic": "remain fragile remove stamp quiz bus country dress critic mammal office need" - }, - { - "name": "rly12", - "type": "local", - "mnemonic": "enlist hip relief stomach skate base shallow young switch frequent cry park" - } - ] -} diff --git a/charts/devnet/configs/keys.json b/charts/devnet/configs/keys.json index ea99b7ed5..88eb2753b 100644 --- a/charts/devnet/configs/keys.json +++ b/charts/devnet/configs/keys.json @@ -1,31 +1,16 @@ { "genesis": [ { - "name": "val0", + "name": "genesis", "type": "local", "mnemonic": "razor dog gown public private couple ecology paper flee connect local robot diamond stay rude join sound win ribbon soup kidney glass robot vehicle" } ], "validators": [ { - "name": "val1", + "name": "validator", "type": "local", "mnemonic": "issue have volume expire shoe year finish poem alien urban license undo rural endless food host opera fix forum crack wide example firm learn" - }, - { - "name": "val2", - "type": "local", - "mnemonic": "broccoli robot upon blush rabbit squeeze fruit still lady antique detect can spice clay magic monster zebra solution dry salute stay wet arena matrix" - }, - { - "name": "val3", - "type": "local", - "mnemonic": "tornado modify spring arm title double bulk other recall decide table fun caught buyer bring once knife sphere arctic text zoo swim visual patient" - }, - { - "name": "val4", - "type": "local", - "mnemonic": "warm marine rent lift siege tool artwork home curious film blade trophy flush angry exact athlete edge combine weasel hour marriage grocery lake famous" } ], "keys": [ @@ -47,14 +32,9 @@ ], "relayers": [ { - "name": "rly1", + "name": "relayer", "type": "local", "mnemonic": "pen quit web pill hunt hobby tonight base wine black era cereal veteran trouble december method diet orbit copper nephew into badge olympic repair" - }, - { - "name": "rly2", - "type": "local", - "mnemonic": "rally area annual range egg solid paper kick cabbage relax grow ginger axis tone penalty swing marine endless vendor dinner guilt echo stable system" } ] } diff --git a/charts/devnet/scripts/create-genesis.sh b/charts/devnet/scripts/create-genesis.sh index 8486b79c1..cdd8d9972 100644 --- a/charts/devnet/scripts/create-genesis.sh +++ b/charts/devnet/scripts/create-genesis.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -eux + DENOM="${DENOM:=uosmo}" COINS="${COINS:=100000000000000000uosmo}" CHAIN_ID="${CHAIN_ID:=osmosis}" @@ -7,7 +9,8 @@ CHAIN_BIN="${CHAIN_BIN:=osmosisd}" CHAIN_DIR="${CHAIN_DIR:=$HOME/.osmosisd}" KEYS_CONFIG="${KEYS_CONFIG:=configs/keys.json}" -set -eux +FAUCET_ENABLED="${FAUCET_ENABLED:=true}" +NUM_VALIDATORS="${NUM_VALIDATORS:=1}" # Args and vars specific to chains ARGS_ADD_GENESIS_ACCOUNT="" @@ -26,11 +29,22 @@ echo "Adding key...." $(jq -r ".genesis[0].name" $KEYS_CONFIG) jq -r ".genesis[0].mnemonic" $KEYS_CONFIG | $CHAIN_BIN keys add $(jq -r ".genesis[0].name" $KEYS_CONFIG) --recover --keyring-backend="test" $CHAIN_BIN $CHAIN_GENESIS_CMD add-genesis-account $($CHAIN_BIN keys show -a $(jq -r .genesis[0].name $KEYS_CONFIG) --keyring-backend="test") $COINS --keyring-backend="test" $ARGS_ADD_GENESIS_ACCOUNT -# todo: adding relayer key is a temporary fix for not having faucet -# Add relayer key to the keyring and self delegate initial coins -echo "Adding key...." $(jq -r ".relayers[0].name" $KEYS_CONFIG) -jq -r ".relayers[0].mnemonic" $KEYS_CONFIG | $CHAIN_BIN keys add $(jq -r ".relayers[0].name" $KEYS_CONFIG) --recover --keyring-backend="test" -$CHAIN_BIN $CHAIN_GENESIS_CMD add-genesis-account $($CHAIN_BIN keys show -a $(jq -r .relayers[0].name $KEYS_CONFIG) --keyring-backend="test") $COINS --keyring-backend="test" $ARGS_ADD_GENESIS_ACCOUNT +## if facuet not enabled then add validator and relayer with index as keys and into gentx +if [[ $FAUCET_ENABLED == "false" && $NUM_VALIDATORS -gt "1" ]]; +then + ## Add validators key and delegate tokens + for i in $(seq 0 $NUM_VALIDATORS); + do + VAL_KEY_NAME="$(jq -r '.validators[0].name' $KEYS_CONFIG)-$i" + echo "Adding validator key.... $VAL_KEY_NAME" + jq -r ".validators[0].mnemonic" $KEYS_CONFIG | $CHAIN_BIN keys add $VAL_KEY_NAME --index $i --recover --keyring-backend="test" + $CHAIN_BIN $CHAIN_GENESIS_CMD add-genesis-account $($CHAIN_BIN keys show -a $VAL_KEY_NAME --keyring-backend="test") $COINS --keyring-backend="test" $ARGS_ADD_GENESIS_ACCOUNT + done + ## Add relayer key and delegate tokens + echo "Adding key...." $(jq -r ".relayers[0].name" $KEYS_CONFIG) + jq -r ".relayers[0].mnemonic" $KEYS_CONFIG | $CHAIN_BIN keys add $(jq -r ".relayers[0].name" $KEYS_CONFIG) --recover --keyring-backend="test" + $CHAIN_BIN $CHAIN_GENESIS_CMD add-genesis-account $($CHAIN_BIN keys show -a $(jq -r .relayers[0].name $KEYS_CONFIG) --keyring-backend="test") $COINS --keyring-backend="test" $ARGS_ADD_GENESIS_ACCOUNT +fi echo "Creating gentx..." COIN=$(echo $COINS | cut -d ',' -f1) diff --git a/charts/devnet/scripts/transfer-tokens.sh b/charts/devnet/scripts/transfer-tokens.sh index 5fd9e514d..c91a9fed5 100644 --- a/charts/devnet/scripts/transfer-tokens.sh +++ b/charts/devnet/scripts/transfer-tokens.sh @@ -3,6 +3,7 @@ ADDRESS="$1" DENOM="$2" FAUCET_URL="$3" +FAUCET_ENABLED="$4" set -eux @@ -14,6 +15,12 @@ function transfer_token() { echo $status_code } +if [[ $FAUCET_ENABLED == "false" ]]; +then + echo "Faucet not enabled... skipping transfer token from faucet" + exit 0 +fi + echo "Try to send tokens, if failed, wait for 5 seconds and try again" max_tries=5 while [[ max_tries -gt 0 ]] diff --git a/charts/devnet/templates/chains/cosmos/genesis.yaml b/charts/devnet/templates/chains/cosmos/genesis.yaml index f5ce1eae6..175b65d60 100644 --- a/charts/devnet/templates/chains/cosmos/genesis.yaml +++ b/charts/devnet/templates/chains/cosmos/genesis.yaml @@ -81,6 +81,10 @@ spec: {{- include "devnet.timeoutVars" $.Values | indent 12 }} - name: KEYS_CONFIG value: /configs/keys.json + - name: FAUCET_ENABLED + value: "{{ $chain.faucet.enabled }}" + - name: NUM_VALIDATORS + value: "{{ $chain.numValidators }}" command: - bash - "-c" @@ -169,6 +173,8 @@ spec: env: {{- include "devnet.defaultEvnVars" $chain | indent 12 }} {{- include "devnet.evnVars" $chain | indent 12 }} + - name: FAUCET_ENABLED + value: "{{ $chain.faucet.enabled }}" command: - bash - "-c" diff --git a/charts/devnet/templates/chains/cosmos/validator.yaml b/charts/devnet/templates/chains/cosmos/validator.yaml index 70e70f8a6..1b27274f6 100644 --- a/charts/devnet/templates/chains/cosmos/validator.yaml +++ b/charts/devnet/templates/chains/cosmos/validator.yaml @@ -86,6 +86,8 @@ spec: {{- include "devnet.genesisVars" $dataExposer | indent 12 }} - name: KEYS_CONFIG value: /configs/keys.json + - name: FAUCET_ENABLED + value: "{{ $chain.faucet.enabled }}" - name: METRICS value: "{{ $chain.metrics }}" command: @@ -103,20 +105,12 @@ spec: exit 0 fi - RECOVER=true - VAL_NAME=$(jq -r ".validators[$VAL_INDEX].name" $KEYS_CONFIG) - [[ $VAL_NAME == "null" ]] && VAL_NAME="validator-$VAL_INDEX" && RECOVER=false + VAL_NAME=$(jq -r ".validators[0].name" $KEYS_CONFIG)-$VAL_INDEX echo "Validator Index: $VAL_INDEX, Key name: $VAL_NAME" - if [[ $RECOVER == "true" ]]; then - echo "Recover validator $VAL_NAME" - jq -r ".validators[$VAL_INDEX].mnemonic" $KEYS_CONFIG | $CHAIN_BIN init $VAL_NAME --chain-id $CHAIN_ID --recover - jq -r ".validators[$VAL_INDEX].mnemonic" $KEYS_CONFIG | $CHAIN_BIN keys add $VAL_NAME --recover --keyring-backend="test" - else - echo "Create validator $VAL_NAME" - $CHAIN_BIN init $VAL_NAME --chain-id $CHAIN_ID - $CHAIN_BIN keys add $VAL_NAME --keyring-backend="test" - fi + echo "Recover validator $VAL_NAME" + $CHAIN_BIN init $VAL_NAME --chain-id $CHAIN_ID + jq -r ".validators[0].mnemonic" $KEYS_CONFIG | $CHAIN_BIN keys add $VAL_NAME --index $VAL_INDEX --recover --keyring-backend="test" curl http://$GENESIS_HOST.$NAMESPACE.svc.cluster.local:$GENESIS_PORT/genesis -o $CHAIN_DIR/config/genesis.json echo "Genesis file that we got....." @@ -183,6 +177,8 @@ spec: {{- include "devnet.defaultEvnVars" $chain | indent 12 }} {{- include "devnet.evnVars" $chain | indent 12 }} {{- include "devnet.genesisVars" $dataExposer | indent 12}} + - name: KEYS_CONFIG + value: /configs/keys.json command: - bash - "-c" @@ -203,13 +199,16 @@ spec: - "-e" - | VAL_INDEX=${HOSTNAME##*-} - VAL_NAME=$(jq -r ".validators[$VAL_INDEX].name" /configs/keys.json) - [[ $VAL_NAME == "null" ]] && VAL_NAME="validator-$VAL_INDEX" + VAL_NAME="$(jq -r ".validators[0].name" $KEYS_CONFIG)-$VAL_INDEX" echo "Validator Index: $VAL_INDEX, Key name: $VAL_NAME. Chain bin $CHAIN_BIN" VAL_ADDR=$($CHAIN_BIN keys show $VAL_NAME -a --keyring-backend="test") echo "Transfer tokens to address $VAL_ADDR before trying to create validator. Best effort" - bash -e /scripts/transfer-tokens.sh $VAL_ADDR $DENOM http://$GENESIS_HOST.$NAMESPACE.svc.cluster.local:8000/credit || true + bash -e /scripts/transfer-tokens.sh \ + $VAL_ADDR \ + $DENOM \ + http://$GENESIS_HOST.$NAMESPACE.svc.cluster.local:8000/credit \ + "{{ $chain.faucet.enabled }}" || true $CHAIN_BIN keys list --keyring-backend test | jq diff --git a/charts/devnet/templates/relayers/go-relayer/statefulset.yaml b/charts/devnet/templates/relayers/go-relayer/statefulset.yaml index e7555b552..838777e9c 100644 --- a/charts/devnet/templates/relayers/go-relayer/statefulset.yaml +++ b/charts/devnet/templates/relayers/go-relayer/statefulset.yaml @@ -61,6 +61,7 @@ spec: {{- range $i, $chain := $relayer.chains }} {{ $fullchain := include "devnet.fullchain" (dict "name" $chain "file" $defaultFile "context" $) | fromJson }} + echo "Adding {{ $fullchain.name }} chain" rly chains add --file "/configs/{{ $fullchain.name }}.json" {{ $fullchain.name }} @@ -70,7 +71,11 @@ spec: DENOM="{{ $fullchain.denom }}" RLY_ADDR=$(rly address "{{ $fullchain.name }}" | awk 'END{print}') echo "Transfer tokens to address $RLY_ADDR on {{ $fullchain.name }} chain with denom $DENOM" - bash -e /scripts/transfer-tokens.sh $RLY_ADDR $DENOM http://{{ include "devnet.chain.name" $fullchain.name }}-genesis.$NAMESPACE.svc.cluster.local:8000/credit + bash -e /scripts/transfer-tokens.sh \ + $RLY_ADDR \ + $DENOM \ + http://{{- include "devnet.chain.name" $fullchain.name }}-genesis.$NAMESPACE.svc.cluster.local:8000/credit \ + "{{ $fullchain.faucet.enabled }}" {{- end }} PATHEND="{{ index $relayer.chains 0 }}-{{ index $relayer.chains 1 }}" diff --git a/charts/devnet/templates/relayers/hermes/statefulset.yaml b/charts/devnet/templates/relayers/hermes/statefulset.yaml index 5db213247..f0d8742ff 100644 --- a/charts/devnet/templates/relayers/hermes/statefulset.yaml +++ b/charts/devnet/templates/relayers/hermes/statefulset.yaml @@ -79,7 +79,12 @@ spec: DENOM="{{ $fullchain.denom }}" RLY_ADDR=$(hermes --json keys list --chain {{ $chain }} | tail -1 | jq -r '.result."{{ $chain }}".account') echo "Transfer tokens to address $RLY_ADDR" - bash -e /scripts/transfer-tokens.sh $RLY_ADDR $DENOM http://{{ $fullchain.hostname }}-genesis.$NAMESPACE.svc.cluster.local:8000/credit + + bash -e /scripts/transfer-tokens.sh \ + $RLY_ADDR \ + $DENOM \ + http://{{ $fullchain.hostname }}-genesis.$NAMESPACE.svc.cluster.local:8000/credit \ + "{{ $fullchain.faucet.enabled }}" {{- end }} hermes create channel \ diff --git a/charts/devnet/templates/relayers/ts-relayer/statefulset.yaml b/charts/devnet/templates/relayers/ts-relayer/statefulset.yaml index c1f4a63eb..4634e9a4b 100644 --- a/charts/devnet/templates/relayers/ts-relayer/statefulset.yaml +++ b/charts/devnet/templates/relayers/ts-relayer/statefulset.yaml @@ -73,7 +73,11 @@ spec: DENOM="{{ $fullchain.denom }}" RLY_ADDR=$(ibc-setup keys list | grep "{{ $fullchain.name }}" | awk '{print $2}') echo "Transfer tokens to address $RLY_ADDR" - bash -e /scripts/transfer-tokens.sh $RLY_ADDR $DENOM http://{{ include "devnet.chain.name" $fullchain.name }}-genesis.$NAMESPACE.svc.cluster.local:8000/credit + bash -e /scripts/transfer-tokens.sh \ + $RLY_ADDR \ + $DENOM \ + http://{{- include "devnet.chain.name" $fullchain.name }}-genesis.$NAMESPACE.svc.cluster.local:8000/credit \ + "{{ $fullchain.faucet.enabled }}" {{- end }} if [ $RLY_INDEX -eq 0 ]; then diff --git a/docs/pages/config/chains.mdx b/docs/pages/config/chains.mdx index d96c3922e..ef79e9a35 100644 --- a/docs/pages/config/chains.mdx +++ b/docs/pages/config/chains.mdx @@ -166,6 +166,9 @@ chains: memory: "600M" ``` +By default, we enable cosmjs faucet. Incase `faucet.enabled` is set to `false`, then we manually add +validator and relayer keys at gentx on genesis. This will take longer during initialization. + > Note `concurrency` in `faucet` is the number of concurrent requests the faucet can handle. If you are running a chain with less resources, or want faster startup time, then you can reduce the `concurrency` to a lower number. diff --git a/tests/e2e/Makefile b/tests/e2e/Makefile index 42be2bc93..0d2804b6f 100644 --- a/tests/e2e/Makefile +++ b/tests/e2e/Makefile @@ -36,7 +36,7 @@ delete: .PHONY: test test: - TEST_CONFIG_FILE=$(HELM_FILE) go test -v ./... + TEST_CONFIG_FILE=$(HELM_FILE) go test -v ./... -count=1 ############################################################################### ### Port forward ### diff --git a/tests/e2e/address.go b/tests/e2e/address.go new file mode 100644 index 000000000..5435f4484 --- /dev/null +++ b/tests/e2e/address.go @@ -0,0 +1,44 @@ +package e2e + +// addresses is a map with type of chain and list of test addresses +var addresses = map[string][]string{ + "osmosis": { + "osmo14lzvt4gdwh2q4ymyjqma0p4j4aykpn929zx75y", + "osmo1clpqr4nrk4khgkxj78fcwwh6dl3uw4epasmvnj", + "osmo15urq2dtp9qce4fyc85m6upwm9xul30495qdm4l", + }, + "custom": { + "osmo14lzvt4gdwh2q4ymyjqma0p4j4aykpn929zx75y", + "osmo1clpqr4nrk4khgkxj78fcwwh6dl3uw4epasmvnj", + "osmo15urq2dtp9qce4fyc85m6upwm9xul30495qdm4l", + }, + "cosmos": { + "cosmos1c4k24jzduc365kywrsvf5ujz4ya6mwymy8vq4q", + "cosmos196ax4vc0lwpxndu9dyhvca7jhxp70rmcfhxsrt", + "cosmos1t5u0jfg3ljsjrh2m9e47d4ny2hea7eehxrzdgd", + }, + "simapp": { + "cosmos1c4k24jzduc365kywrsvf5ujz4ya6mwymy8vq4q", + "cosmos196ax4vc0lwpxndu9dyhvca7jhxp70rmcfhxsrt", + "cosmos1t5u0jfg3ljsjrh2m9e47d4ny2hea7eehxrzdgd", + }, + "persistencecore": { + "persistence13frxdtypzz722wy3ylzlmh8tqcyje8lhtuhkfc", + "persistence1rq598kexpsdmhxq63qq74v3tf22u6yvl2a47xk", + "persistence1tzn8rk09ez2gm55sffpyzt7ccn5yzshpfm8743", + }, + "evmos": { + "evmos1sp9frqwep52chwavv3xd776myy8gyyvkp6n53z", + "evmos1zwr06uz8vrwkcnd05e5yddamvghn93a467tf0q", + "evmos1f35jtt5m68zlxkpxn75403vv82cchahqp8lnau", + }, + "injective": { + "inj1acgud5qpn3frwzjrayqcdsdr9vkl3p6h5yys25", + "inj1hsxaln75wjs033t3spd8a0gawl4jvxawyuez5p", + "inj1lsuqpgm8kgwpq96ewyew26xnfwyn3lh3y7knzj", + }, +} + +func getAddressFromType(chainType string) string { + return addresses[chainType][0] +} diff --git a/tests/e2e/configs/two-chain.yaml b/tests/e2e/configs/two-chain.yaml index 45ac7fdf2..b8e1b16b5 100644 --- a/tests/e2e/configs/two-chain.yaml +++ b/tests/e2e/configs/two-chain.yaml @@ -11,11 +11,12 @@ chains: type: cosmos image: ghcr.io/cosmology-tech/starship/gaia:v10.0.1 numValidators: 2 + faucet: + enabled: false ports: rest: 1317 rpc: 26657 exposer: 38087 - faucet: 8000 relayers: - name: osmos-cosmos diff --git a/tests/e2e/exposer_test.go b/tests/e2e/exposer_test.go index ae001c1c2..2f47ab68f 100644 --- a/tests/e2e/exposer_test.go +++ b/tests/e2e/exposer_test.go @@ -137,7 +137,7 @@ func (s *TestSuite) TestExposer_GetKeys() { // assert results to expected values s.Require().NotNil(resp) s.Require().Len(resp.Genesis, 1) - s.Require().Len(resp.Validators, 4) + s.Require().Len(resp.Validators, 1) s.Require().Len(resp.Keys, 3) - s.Require().Len(resp.Relayers, 2) + s.Require().Len(resp.Relayers, 1) } diff --git a/tests/e2e/faucet_test.go b/tests/e2e/faucet_test.go index ca0b4259e..a8ac3d1f4 100644 --- a/tests/e2e/faucet_test.go +++ b/tests/e2e/faucet_test.go @@ -118,9 +118,8 @@ func (s *TestSuite) TestFaucet_Credit() { } // fetch denom and address from an account on chain - accounts := s.getChainAccounts(chain) denom := s.getChainDenoms(chain) - addr := accounts[len(accounts)-1] + addr := getAddressFromType(chain.Type) beforeBalance := s.getAccountBalance(chain, addr, denom) body := map[string]string{ @@ -136,9 +135,9 @@ func (s *TestSuite) TestFaucet_Credit() { s.Require().NoError(err) s.Require().Equal(200, resp.StatusCode) - time.Sleep(2 * time.Second) + time.Sleep(4 * time.Second) afterBalance := s.getAccountBalance(chain, addr, denom) - + s.T().Log("address:", addr, "after balance: ", afterBalance, "before balance:", beforeBalance) // note sometimes expected difference is 9x expected value (bug due to using holder address for test) // hence checking for difference is atleast expected value s.Require().GreaterOrEqual(afterBalance-beforeBalance, expCreditedAmt) diff --git a/tests/e2e/registry_test.go b/tests/e2e/registry_test.go index e0f376cff..a550aaabd 100644 --- a/tests/e2e/registry_test.go +++ b/tests/e2e/registry_test.go @@ -267,8 +267,8 @@ func (s *TestSuite) TestRegistry_GetChainKeys() { // assert results to expected values s.Require().Len(respKeys.Genesis, 1) - s.Require().Len(respKeys.Validators, 4) + s.Require().Len(respKeys.Validators, 1) s.Require().Len(respKeys.Keys, 3) - s.Require().Len(respKeys.Relayers, 2) + s.Require().Len(respKeys.Relayers, 1) } }