Skip to content

Commit

Permalink
fix: use chain name as type of chain in registry if type is custom (#416
Browse files Browse the repository at this point in the history
)

* use chain name as type of chain in registry if type is custom

* cut rc12

* update registry tests for custom chain type
  • Loading branch information
Anmol1696 authored Feb 12, 2024
1 parent f54b134 commit bfad04a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
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.48-rc11
version: 0.1.48-rc12

# 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
8 changes: 8 additions & 0 deletions charts/devnet/templates/registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ data:
assetlist.json: |-
{
"$schema": "../assetlist.schema.json",
{{- if eq $chain.type "custom" }}
"chain_name": "{{ $chain.name }}",
{{- else }}
"chain_name": "{{ $chain.type }}",
{{- end }}
{{- if hasKey $chain "assets" }}
"assets": {{ toJson $chain.assets }}
{{- else }}
Expand Down Expand Up @@ -145,7 +149,11 @@ data:
chain.json: |-
{
"$schema": "../chain.schema.json",
{{- if eq $chain.type "custom" }}
"chain_name": "{{ $chain.name }}",
{{- else }}
"chain_name": "{{ $chain.type }}",
{{- end }}
"status": "live",
"network_type": "mainnet",
"chain_id": "{{ $chain.name }}",
Expand Down
20 changes: 16 additions & 4 deletions tests/e2e/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ func (s *TestSuite) TestRegistry_ListChains() {
expChain := s.config.GetChain(chain.ChainId)
s.Require().NotNil(expChain)

s.Require().Equal(expChain.Type, chain.ChainName)
if expChain.Type == "custom" {
s.Require().Equal(expChain.Name, chain.ChainName)
} else {
s.Require().Equal(expChain.Type, chain.ChainName)
}
}
}

Expand All @@ -79,7 +83,11 @@ func (s *TestSuite) TestRegistry_GetChain() {
s.MakeRegistryRequest(req, respChain)

s.Require().Equal(chain.Name, respChain.ChainId)
s.Require().Equal(chain.Type, respChain.ChainName)
if chain.Type == "custom" {
s.Require().Equal(chain.Name, respChain.ChainName)
} else {
s.Require().Equal(chain.Type, respChain.ChainName)
}
if chain.Ports.Rpc != 0 {
s.Require().Equal(fmt.Sprintf("http://localhost:%d", chain.Ports.Rpc), respChain.Apis.Rpc[0].Address)
}
Expand Down Expand Up @@ -161,10 +169,14 @@ func (s *TestSuite) TestRegistry_GetChainAssets() {
respAssets := &pb.ResponseChainAssets{}
s.MakeRegistryRequest(req, respAssets)

s.Require().Equal(chain.Type, respAssets.ChainName)
chainName := chain.Type
if chain.Type == "custom" {
chainName = chain.Name
}
s.Require().Equal(chainName, respAssets.ChainName)

expNumAssets := 1
if n, ok := expectedAssets[chain.Type]; ok {
if n, ok := expectedAssets[chainName]; ok {
expNumAssets = n
}

Expand Down

0 comments on commit bfad04a

Please sign in to comment.