Skip to content

Commit

Permalink
refactor and log improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
shahbazn committed Nov 29, 2023
1 parent 69c7fc6 commit 1b398dd
Show file tree
Hide file tree
Showing 10 changed files with 452 additions and 307 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
*.so
*.dylib

# vscode
.vscode

# direnv
.envrc

# Test binary, built with `go test -c`
*.test

Expand Down
11 changes: 8 additions & 3 deletions cmd/relayer_exporter/relayer_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.uber.org/zap"

"github.com/archway-network/relayer_exporter/pkg/collector"
"github.com/archway-network/relayer_exporter/pkg/config"
Expand Down Expand Up @@ -45,11 +46,12 @@ func main() {

log.Info(
fmt.Sprintf(
"Getting IBC paths from %s/%s/%s on GitHub",
"Github IBC registry: %s/%s",
cfg.GitHub.Org,
cfg.GitHub.Repo,
cfg.GitHub.IBCDir,
),
zap.String("Mainnet Directory", cfg.GitHub.IBCDir),
zap.String("Testnet Directory", cfg.GitHub.TestnetsIBCDir),
)

// TODO: Add a feature to refresh paths at configured interval
Expand All @@ -58,7 +60,10 @@ func main() {
log.Fatal(err.Error())
}

rpcs := cfg.GetRPCsMap()
rpcs, err := cfg.GetRPCsMap(paths)
if err != nil {
log.Fatal(err.Error())
}

ibcCollector := collector.IBCCollector{
RPCs: rpcs,
Expand Down
78 changes: 48 additions & 30 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
---
github:
org: archway-network
repo: networks
dir: _IBC
testnetsDir: testnets/_IBC
rpc:
# mainnets
- chainName: archway
chainId: archway-1
url: https://rpc.mainnet.archway.io:443
- chainName: agoric
chainId: agoric-3
url: https://main.rpc.agoric.net:443
url: https://agoric.rpc.kjnodes.com:443
- chainName: axelar
chainId: axelar-dojo-1
url: https://axelar-rpc.polkachu.com:443
- chainName: axelartestnet
chainId: axelar-testnet-lisbon-3
url: https://rpc-axelar-testnet.imperator.co:443
- chainName: archwaytestnet
chainId: constantine-3
url: https://rpc.constantine.archway.tech:443
url: https://rpc-1.axelar.nodes.guru:443
- chainName: bitcanna
chainId: bitcanna-1
url: https://rpc.bitcanna.io:443
- chainName: cosmoshub
chainId: cosmoshub-4
url: https://cosmoshub-rpc.stakely.io:443
- chainName: decentr
chainId: mainnet-3
url: https://poseidon.mainnet.decentr.xyz:443
- chainName: jackal
chainId: jackal-1
url: https://jackal-rpc.polkachu.com:443
Expand All @@ -29,45 +31,61 @@ rpc:
url: https://juno-rpc.publicnode.com:443
- chainName: kujira
chainId: kaiyo-1
url: https://kujira-rpc.polkachu.com:443
url: https://kujira-rpc.publicnode.com:443
- chainName: noble
chainId: noble-1
url: https://noble-rpc.polkachu.com:443
- chainName: nois
chainId: nois-1
url: https://nois.rpc.kjnodes.com:443
- chainName: osmosistestnet
chainId: osmo-test-5
url: https://rpc.osmotest5.osmosis.zone:443
- chainName: omniflixhub
chainId: omniflixhub-1
url: https://omniflix.kingnodes.com:443
- chainName: osmosis
chainId: osmosis-1
url: https://osmosis-rpc.stakely.io:443
- chainName: quicksilver
chainId: quicksilver-2
url: https://rpc.quicksilver.zone:443
- chainName: akashtestnet
chainId: sandbox-01
url: https://rpc.sandbox-01.aksh.pw:443
- chainName: umee
chainId: umee-1
url: https://rpc-umee.mzonder.com:443
- chainName: gravitybridge
chainId: gravity-bridge-3
url: https://gravitychain.io:26657
- chainName: omniflixhub
chainId: omniflixhub-1
url: https://rpc-omniflix.mzonder.com:443
- chainName: decentr
chainId: mainnet-3
url: https://poseidon.mainnet.decentr.xyz:443
- chainName: secretnetwork
chainId: secret-4
url: https://rpc.secret.express:443
- chainName: terra2
chainId: phoenix-1
url: https://terra-rpc.stakely.io:443
- chainName: comdex
chainId: comdex-1
url: https://rpc.comdex.one:443
- chainName: neutron
chainId: neutron-1
url: https://rpc-kralum.neutron-1.neutron.org:443
- chainName: stargaze
chainId: stargaze-1
url: https://rpc.stargaze-apis.com:443

github:
org: archway-network
repo: networks
dir: _IBC
testnetsDir: testnets/_IBC
# testnets
- chainName: archwaytestnet
chainId: constantine-3
url: https://rpc.constantine.archway.tech:443
- chainName: axelartestnet
chainId: axelar-testnet-lisbon-3
url: https://axelar-testnet-rpc.qubelabs.io:443
- chainName: osmosistestnet
chainId: osmo-test-5
url: https://rpc.osmotest5.osmosis.zone:443

accounts:
- address: archway1l2al7y78500h5akvgt8exwnkpmf2zmk8ky9ht3
chainName: archwaytestnet
denom: aconst
# Foundation
- address: archway1gpyqzc0aerc85cpk2cm8ec6zkc95x5yqrakskv
chainName: archway
denom: aarch
# PhiLabs
- address: archway1ktka5q3cnsy3ar7qwj2huzz6qj9q4ys7h74l9y
chainName: archway
denom: aarch
17 changes: 17 additions & 0 deletions pkg/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package chain

import (
"context"
"fmt"

"github.com/cosmos/relayer/v2/relayer"
"github.com/cosmos/relayer/v2/relayer/chains/cosmos"
Expand Down Expand Up @@ -54,3 +55,19 @@ func PrepChain(info Info) (*relayer.Chain, error) {

return chain, nil
}

func ValidateChainInfo(info Info) error {
if info.ChainID == "" {
return fmt.Errorf("missing chain ID: %v", info)
}

if info.RPCAddr == "" {
return fmt.Errorf("missing RPC address: %v", info)
}

if info.ClientID == "" {
return fmt.Errorf("missing client ID: %v", info)
}

return nil
}
Loading

0 comments on commit 1b398dd

Please sign in to comment.