diff --git a/charts/devnet/Chart.yaml b/charts/devnet/Chart.yaml index 868cb55a4..423bd944b 100644 --- a/charts/devnet/Chart.yaml +++ b/charts/devnet/Chart.yaml @@ -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.22 +version: 0.1.23 # 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 diff --git a/charts/devnet/templates/_helpers.tpl b/charts/devnet/templates/_helpers.tpl index d5bcf128f..c8d3c4473 100644 --- a/charts/devnet/templates/_helpers.tpl +++ b/charts/devnet/templates/_helpers.tpl @@ -188,7 +188,7 @@ Returns a comma seperated list of urls for the RPC address Returns a comma seperated list of urls for the Exposer address */}} {{- define "devnet.chains.exposer.addrs" -}} -{{- $port := ($.Values.exposer.ports.rest | default "8081") }} +{{- $port := ($.Values.exposer.ports.rest | toString | default "8081") }} {{- $values := list -}} {{- range $chain := .Values.chains -}} {{- $values = printf "http://%s-genesis.$(NAMESPACE).svc.cluster.local:%s" $chain.name $port | append $values -}} diff --git a/registry/Makefile b/registry/Makefile index 26e5f1bd9..2064ccc38 100644 --- a/registry/Makefile +++ b/registry/Makefile @@ -15,10 +15,21 @@ build: run: bazel run //$(BINARY_NAME):$(BINARY_NAME) -- \ + --http-port "8001" --grpc-port "9001" \ --chain-registry $(CURDIR)/testdata/ \ --chain-client-ids "osmosis-1,juno-0" \ --chain-client-rpcs "https://rpc.osmosis.zone:443,https://rpc.juno.strange.love:443" +# Assumes a local starship cluster is running +# Uses tests/config.yaml as the base config +run-local: + bazel run //$(BINARY_NAME):$(BINARY_NAME) -- \ + --http-port "8001" --grpc-port "9001" \ + --chain-registry $(CURDIR)/testdata/ \ + --chain-client-ids "osmosis-1,cosmoshub-4" \ + --chain-client-rpcs "http://localhost:26653,http://localhost:26657" \ + --chain-client-exposer "http://localhost:38083,http://localhost:38087" + ## Docker commands docker-build: bazel build //$(BINARY_NAME):image diff --git a/registry/chain.go b/registry/chain.go index 6a705ed87..311d74aa8 100644 --- a/registry/chain.go +++ b/registry/chain.go @@ -2,9 +2,7 @@ package main import ( "context" - "encoding/json" "fmt" - "io" "net/http" "os" "strings" @@ -14,6 +12,7 @@ import ( clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/cosmos/ibc-go/v7/modules/core/exported" ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + "github.com/golang/protobuf/jsonpb" lens "github.com/strangelove-ventures/lens/client" "github.com/strangelove-ventures/lens/client/query" "go.uber.org/zap" @@ -152,13 +151,8 @@ func (c *ChainClient) GetChainKeys(ctx context.Context) (*pb.Keys, error) { return nil, err } - respData, err := io.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - var keys *pb.Keys - err = json.Unmarshal(respData, keys) + keys := &pb.Keys{} + err = jsonpb.Unmarshal(resp.Body, keys) if err != nil { return nil, err } diff --git a/tests/config.yaml b/tests/config.yaml index 788648afd..59734c9cb 100644 --- a/tests/config.yaml +++ b/tests/config.yaml @@ -6,7 +6,7 @@ chains: rest: 1313 rpc: 26653 exposer: 38083 - - name: cosmoshub-1 + - name: cosmoshub-4 type: cosmos numValidators: 2 ports: @@ -20,7 +20,7 @@ relayers: replicas: 1 chains: - osmosis-1 - - cosmoshub-1 + - cosmoshub-4 explorer: enabled: true diff --git a/tests/registry_test.go b/tests/registry_test.go index 393acf6eb..a7711db59 100644 --- a/tests/registry_test.go +++ b/tests/registry_test.go @@ -129,3 +129,21 @@ func (s *TestSuite) TestRegistry_ListIBC() { // assert results to expected values s.Assert().Len(respIBC.Data, len(s.config.Relayers)*2, "number of ibc information should be double the number of relayers") } + +func (s *TestSuite) TestRegistry_GetChainKeys() { + s.T().Log("runing test for /chains/{chain}/keys endpoint for registry") + + for _, chain := range s.config.Chains { + req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("/chains/%s/keys", chain.Name), nil) + s.Require().NoError(err) + + respKeys := &pb.Keys{} + s.MakeRegistryRequest(req, respKeys) + + // assert results to expected values + s.Assert().Len(respKeys.Genesis, 1) + s.Assert().Len(respKeys.Validators, 4) + s.Assert().Len(respKeys.Keys, 3) + s.Assert().Len(respKeys.Relayers, 2) + } +}