Skip to content

Commit

Permalink
Merge branch 'refactor-and-log' into fix/audit
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrajovic committed Mar 28, 2024
2 parents 6381f2a + a144a72 commit ce998dd
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions orchestrator/cosmos/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ type Network interface {
}

func NewNetwork(k keyring.Keyring, ethSignFn keystore.PersonalSignFn, cfg NetworkConfig) (Network, error) {
log.WithFields(log.Fields{
"chain_id": cfg.ChainID,
"orchestrator_addr": cfg.ValidatorAddress,
"grpc": cfg.CosmosGRPC,
"tendermint_rpc": cfg.TendermintRPC,
"gas_price": cfg.GasPrice,
}).Debugln("Injective network config")

clientCfg := cfg.loadClientConfig()

clientCtx, err := chain.NewClientContext(clientCfg.ChainId, cfg.ValidatorAddress, k)
Expand Down Expand Up @@ -108,10 +100,14 @@ func awaitConnection(client chain.ChainClient, timeout time.Duration) *grpc.Clie

func (cfg NetworkConfig) loadClientConfig() clientcommon.Network {
if custom := cfg.CosmosGRPC != "" && cfg.TendermintRPC != ""; custom {
log.WithFields(log.Fields{"cosmos_grpc": cfg.CosmosGRPC, "tendermint_rpc": cfg.TendermintRPC}).Debugln("using custom endpoints for Injective")
return customEndpoints(cfg)
}

return loadBalancedEndpoints(cfg)
c := loadBalancedEndpoints(cfg)
log.WithFields(log.Fields{"cosmos_grpc": c.ChainGrpcEndpoint, "tendermint_rpc": c.TmEndpoint}).Debugln("using load balanced endpoints for Injective")

return c
}

func customEndpoints(cfg NetworkConfig) clientcommon.Network {
Expand Down

0 comments on commit ce998dd

Please sign in to comment.