Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: chain registry upgrade #532

Merged
merged 5 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion starship/charts/devnet/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defaultChains:
binary: osmosisd
prefix: osmo
denom: uosmo
prettyName: osmosis
prettyName: Osmosis
coins: 100000000000000uosmo,100000000000000uion
hdPath: m/44'/118'/0'/0/0
coinType: 118
Expand Down
51 changes: 29 additions & 22 deletions starship/charts/devnet/templates/registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,25 +127,25 @@ data:
"assets": {{ toJson $chain.assets }}
{{- else }}
"assets": [
{
"description": "The denom for token {{ $chain.denom }}",
"base": "{{ $chain.denom }}",
"name": "{{ $chain.denom }}",
"display": "{{ $chain.denom }}",
"symbol": "{{ $chain.denom | upper }}",
"denom_units": [
{
"denom": "{{ $chain.denom }}",
"exponent": 0
},
{
"denom": "{{ $chain.denom }}",
"exponent": 6
}
],
"coingecko_id": "{{ $chain.name }}"
}
]
{
"description": "The denom for token {{ $chain.denom }}",
"base": "{{ $chain.denom }}",
"name": "{{ $chain.denom }}",
"display": "{{ $chain.denom }}",
"symbol": "{{ $chain.denom | upper }}",
"denom_units": [
{
"denom": "{{ $chain.denom }}",
"exponent": 0
},
{
"denom": "{{ $chain.denom }}",
"exponent": 6
}
],
"coingecko_id": "{{ $chain.name }}"
}
]
{{- end }}
}
chain.json: |-
Expand All @@ -157,9 +157,9 @@ data:
"chain_name": "{{ $chain.name }}",
{{- end }}
"status": "live",
"network_type": "mainnet",
"network_type": "devnet",
"chain_id": "{{ $chain.id }}",
"pretty_name": "{{ $chain.prettyName }}",
"pretty_name": "{{ $chain.prettyName }} Devnet",
"bech32_prefix": "{{ $chain.prefix }}",
"daemon_name": "{{ $chain.binary }}",
"node_home": "{{ $chain.home }}",
Expand Down Expand Up @@ -189,7 +189,14 @@ data:
}
},
"codebase": {
"git_repo": "{{ $chain.repo }}"
"git_repo": "{{ $chain.repo }}",
"compatible_versions": [],
"binaries": {},
"ics_enabled": [],
"versions": [],
"consensus": {
"type": "tendermint"
}
},
{{- if $.Values.explorer.enabled }}
"explorers": [
Expand Down
113 changes: 83 additions & 30 deletions starship/proto/registry/chain.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ message Staking_tokens {
}

message Lock_duration {
string time = 1 [json_name = "time"];
oneof duration {
uint32 blocks = 1 [json_name = "blocks"];
string time = 2 [json_name = "time"];
}
}

message Staking {
Expand All @@ -33,29 +36,59 @@ message Staking {
message Genesis {
string name = 1 [json_name = "name"];
string genesis_url = 2 [json_name = "genesis_url"];
optional string ics_ccv_url = 3 [json_name = "ics_ccv_url"];
}

message Versions {
string name = 1 [json_name = "name"];
string tag = 2 [json_name = "tag"];
uint32 height = 3 [json_name = "height"];
optional string next_version_name = 4 [json_name = "next_version_name"];
optional string proposal = 4 [json_name = "proposal"];
optional string previous_version_name = 5 [json_name = "previous_version_name"];
optional string next_version_name = 6 [json_name = "next_version_name"];
optional string recommended_version = 7 [json_name = "recommended_version"];
optional string go_version = 8 [json_name = "go_version"];
repeated string compatible_versions = 9 [json_name = "compatible_versions"];
optional string cosmos_sdk_version = 10 [json_name = "cosmos_sdk_version"];
message Consensus {
string type = 1 [json_name = "type"];
optional string version = 2 [json_name = "version"];
}
optional Consensus consensus = 11 [json_name = "consensus"];
optional string cosmwasm_version = 12 [json_name = "cosmwasm_version"];
optional bool cosmwasm_enabled = 13 [json_name = "cosmwasm_enabled"];
optional string cosmwasm_path = 14 [json_name = "cosmwasm_path"];
optional string ibc_go_version = 15 [json_name = "ibc_go_version"];
repeated string ics_enabled = 16 [json_name = "ics_enabled"];
message Binaries {
optional string linux_amd64 = 1 [json_name = "linux/amd64"];
optional string linux_arm64 = 2 [json_name = "linux/arm64"];
optional string darwin_amd64 = 3 [json_name = "darwin/amd64"];
optional string darwin_arm64 = 4 [json_name = "darwin/arm64"];
optional string windows_amd64 = 5 [json_name = "windows/amd64"];
optional string windows_arm64 = 6 [json_name = "windows/arm64"];
}
optional Binaries binaries = 17 [json_name = "binaries"];
}

message Codebase {
string git_repo = 1 [json_name = "git_repo"];
optional string recommended_version = 2 [json_name = "recommended_version"];
repeated string compatible_versions = 3 [json_name = "compatible_versions"];
map<string,string> binaries = 4 [json_name = "binaries"];
optional Versions.Binaries binaries = 4 [json_name = "binaries"];
optional string cosmos_sdk_version = 5 [json_name = "cosmos_sdk_version"];
optional string tendermint_version = 6 [json_name = "tendermint_version"];
message Consensus {
string type = 1 [json_name = "type"];
optional string version = 2 [json_name = "version"];
}
optional Consensus consensus = 6 [json_name = "consensus"];
optional string cosmwasm_version = 7 [json_name = "cosmwasm_version"];
optional bool cosmwasm_enabled = 8 [json_name = "cosmwasm_enabled"];
optional string ibc_go_version = 9 [json_name = "ibc_go_version"];
repeated string ics_enabled = 10 [json_name = "ics_enabled"];
optional Genesis genesis = 11 [json_name = "genesis"];
repeated Versions versions = 12 [json_name = "versions"];
map<string,string> consensus = 13 [json_name = "consensus"];
optional string cosmwasm_path = 9 [json_name = "cosmwasm_path"];
optional string ibc_go_version = 10 [json_name = "ibc_go_version"];
repeated string ics_enabled = 11 [json_name = "ics_enabled"];
optional Genesis genesis = 12 [json_name = "genesis"];
repeated Versions versions = 13 [json_name = "versions"];
}

message LogoURIs {
Expand Down Expand Up @@ -83,45 +116,65 @@ message APIs {
message API {
string address = 1 [json_name = "address"];
string provider = 2 [json_name = "provider"];
optional bool archive = 3 [json_name = "archive"];
}

repeated API rpc = 1 [json_name = "rpc"];
repeated API rest = 2 [json_name = "rest"];
repeated API grpc = 3 [json_name = "grpc"];
repeated API wss = 4 [json_name = "wss"];
repeated API grpc_web = 5 [json_name = "grpc-web"];
repeated API evm_http_jsonrpc = 6 [json_name = "evm-http-jsonrpc"];
}

message Explorer {
string kind = 1 [json_name = "kind"];
string url = 2 [json_name = "url"];
optional string tx_page = 3 [json_name = "tx_page"];
optional string account_page = 4 [json_name = "account_page"];
optional string validator_page = 5 [json_name = "validator_page"];
optional string proposal_page = 6 [json_name = "proposal_page"];
optional string block_page = 7 [json_name = "block_page"];
}

message ChainRegistry {
string schema = 1 [json_name = "$schema"];
string chain_name = 2 [json_name = "chain_name"];
string chain_id = 3 [json_name = "chain_id"];
string pretty_name = 4 [json_name = "pretty_name"];
optional string status = 5 [json_name = "status"];
optional string network_type = 6 [json_name = "network_type"];
optional string website = 7 [json_name = "website"];
optional string bech32_prefix = 8 [json_name = "bech32_prefix"];
optional string daemon_name = 9 [json_name = "daemon_name"];
optional string node_home = 10 [json_name = "node_home"];
repeated string key_algos = 11 [json_name = "key_algos"];
uint32 slip44 = 12 [json_name = "slip44"];
optional Fees fees = 13 [json_name = "fees"];
optional Staking staking = 14 [json_name = "staking"];
optional Codebase codebase = 15 [json_name = "codebase"];
optional LogoURIs logo_URIs = 16 [json_name = "logo_URIs"];
repeated Image images = 17 [json_name = "images"];
optional Peers peers = 18 [json_name = "peers"];
optional APIs apis = 19 [json_name = "apis"];
repeated Explorer explorers = 20 [json_name = "explorers"];
repeated string keywords = 21 [json_name = "keywords"];
optional string update_link = 22 [json_name = "update_link"];
}

optional string pre_fork_chain_name = 4 [json_name = "pre_fork_chain_name"];
string pretty_name = 5 [json_name = "pretty_name"];
optional string website = 6 [json_name = "website"];
optional string update_link = 7 [json_name = "update_link"];
string status = 8 [json_name = "status"];
string network_type = 9 [json_name = "network_type"];
string bech32_prefix = 10 [json_name = "bech32_prefix"];
message Bech32Config {
optional string bech32PrefixAccAddr = 1 [json_name = "bech32PrefixAccAddr"];
optional string bech32PrefixAccPub = 2 [json_name = "bech32PrefixAccPub"];
optional string bech32PrefixValAddr = 3 [json_name = "bech32PrefixValAddr"];
optional string bech32PrefixValPub = 4 [json_name = "bech32PrefixValPub"];
optional string bech32PrefixConsAddr = 5 [json_name = "bech32PrefixConsAddr"];
optional string bech32PrefixConsPub = 6 [json_name = "bech32PrefixConsPub"];
}
optional Bech32Config bech32_config = 11 [json_name = "bech32_config"];
string daemon_name = 12 [json_name = "daemon_name"];
string node_home = 13 [json_name = "node_home"];
repeated string key_algos = 14 [json_name = "key_algos"];
uint32 slip44 = 15 [json_name = "slip44"];
repeated uint32 alternative_slip44s = 16 [json_name = "alternative_slip44s"];
optional Fees fees = 17 [json_name = "fees"];
optional Staking staking = 18 [json_name = "staking"];
optional Codebase codebase = 19 [json_name = "codebase"];
optional LogoURIs logo_URIs = 20 [json_name = "logo_URIs"];
repeated Image images = 21 [json_name = "images"];
optional Peers peers = 22 [json_name = "peers"];
optional APIs apis = 23 [json_name = "apis"];
repeated Explorer explorers = 24 [json_name = "explorers"];
repeated string keywords = 25 [json_name = "keywords"];
repeated string extra_codecs = 26 [json_name = "extra_codecs"];
}

// DenomUnit and ChainAsset messages
message DenomUnit {
string denom = 1 [json_name = "denom"];
int32 exponent = 2 [json_name = "exponent"];
Expand Down
13 changes: 13 additions & 0 deletions starship/registry/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/go-chi/chi/middleware"
"github.com/go-chi/cors"
grpcmiddleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpczap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap"
grpcrecovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
Expand Down Expand Up @@ -172,6 +173,18 @@ func (a *AppServer) panicRecovery(next http.Handler) http.Handler {
return http.HandlerFunc(fn)
}

func (a *AppServer) corsMiddleware(next http.Handler) http.Handler {
corsOptions := cors.Options{
AllowedOrigins: []string{"*"}, // Adjust this to your needs
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
ExposedHeaders: []string{"Link"},
AllowCredentials: true,
MaxAge: 300, // Maximum value not ignored by any of major browsers
}
return cors.New(corsOptions).Handler(next)
}

func (a *AppServer) Run() error {
a.logger.Info("App starting", zap.Any("Config", a.config))

Expand Down
1 change: 1 addition & 0 deletions starship/registry/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.21
require (
github.com/cosmos/ibc-go/v7 v7.0.0-rc0
github.com/go-chi/chi v1.5.4
github.com/go-chi/cors v1.2.1
github.com/golang/protobuf v1.5.4
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1
Expand Down
2 changes: 2 additions & 0 deletions starship/registry/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU=
github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/go-chi/chi v1.5.4 h1:QHdzF2szwjqVV4wmByUnTcsbIg7UGaQ0tPF2t5GcAIs=
github.com/go-chi/chi v1.5.4/go.mod h1:uaf8YgoFazUOkPBG7fxPftUylNumIev9awIWOENIuEg=
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand Down
Loading
Loading