Skip to content

Commit

Permalink
Merge pull request #68 from InjectiveLabs/master
Browse files Browse the repository at this point in the history
  • Loading branch information
albertchon authored Jul 5, 2022
2 parents d7243a9 + 8969871 commit ade8906
Show file tree
Hide file tree
Showing 39 changed files with 4,814 additions and 1,023 deletions.
5 changes: 4 additions & 1 deletion cmd/peggo/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import (
"os"
"time"

"github.com/InjectiveLabs/peggo/orchestrator/metrics"
"github.com/InjectiveLabs/metrics"
cli "github.com/jawher/mow.cli"
"github.com/xlab/closer"
log "github.com/xlab/suplog"
)

func initMetrics(c *cli.Cmd) {
var (
statsdAgent *string
statsdPrefix *string
statsdAddr *string
statsdStuckDur *string
Expand All @@ -21,6 +22,7 @@ func initMetrics(c *cli.Cmd) {

initStatsdOptions(
c,
&statsdAgent,
&statsdPrefix,
&statsdAddr,
&statsdStuckDur,
Expand All @@ -36,6 +38,7 @@ func initMetrics(c *cli.Cmd) {
for {
hostname, _ := os.Hostname()
err := metrics.Init(*statsdAddr, checkStatsdPrefix(*statsdPrefix), &metrics.StatterConfig{
Agent: *statsdAgent,
EnvName: *envName,
HostName: hostname,
StuckFunctionTimeout: duration(*statsdStuckDur, 30*time.Minute),
Expand Down
8 changes: 8 additions & 0 deletions cmd/peggo/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,20 @@ func initEthereumKeyOptions(
// initStatsdOptions sets options for StatsD metrics.
func initStatsdOptions(
cmd *cli.Cmd,
statsdAgent **string,
statsdPrefix **string,
statsdAddr **string,
statsdStuckDur **string,
statsdMocking **string,
statsdDisabled **string,
) {
*statsdAgent = cmd.String(cli.StringOpt{
Name: "statsd-agent",
Desc: "Specify StatsD agent.",
EnvVar: "PEGGO_STATSD_AGENT",
Value: "telegraf",
})

*statsdPrefix = cmd.String(cli.StringOpt{
Name: "statsd-prefix",
Desc: "Specify StatsD compatible metrics prefix.",
Expand Down
7 changes: 4 additions & 3 deletions cmd/peggo/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import (
"github.com/xlab/closer"
log "github.com/xlab/suplog"

"github.com/InjectiveLabs/sdk-go/chain/client"
"github.com/InjectiveLabs/sdk-go/chain/peggy/types"
chainclient "github.com/InjectiveLabs/sdk-go/client/chain"
"github.com/InjectiveLabs/sdk-go/client/common"

"github.com/InjectiveLabs/peggo/orchestrator"
"github.com/InjectiveLabs/peggo/orchestrator/coingecko"
Expand Down Expand Up @@ -173,7 +174,7 @@ func orchestratorCmd(cmd *cli.Cmd) {
log.Infoln("Using Cosmos ValAddress", valAddress.String())
log.Infoln("Using Ethereum address", ethKeyFromAddress.String())

clientCtx, err := client.NewClientContext(*cosmosChainID, valAddress.String(), cosmosKeyring)
clientCtx, err := chainclient.NewClientContext(*cosmosChainID, valAddress.String(), cosmosKeyring)
if err != nil {
log.WithError(err).Fatalln("failed to initialize cosmos client context")
}
Expand All @@ -184,7 +185,7 @@ func orchestratorCmd(cmd *cli.Cmd) {
}
clientCtx = clientCtx.WithClient(tmRPC)

daemonClient, err := client.NewCosmosClient(clientCtx, *cosmosGRPC, client.OptionGasPrices(*cosmosGasPrices))
daemonClient, err := chainclient.NewChainClient(clientCtx, *cosmosGRPC, common.OptionGasPrices(*cosmosGasPrices))
if err != nil {
log.WithError(err).WithFields(log.Fields{
"endpoint": *cosmosGRPC,
Expand Down
7 changes: 4 additions & 3 deletions cmd/peggo/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (
log "github.com/xlab/suplog"

"github.com/InjectiveLabs/peggo/orchestrator/cosmos"
"github.com/InjectiveLabs/sdk-go/chain/client"
"github.com/InjectiveLabs/sdk-go/chain/peggy/types"
chainclient "github.com/InjectiveLabs/sdk-go/client/chain"
"github.com/InjectiveLabs/sdk-go/client/common"
)

// txCmdSubset contains actions that can sign and send messages to Cosmos module
Expand Down Expand Up @@ -129,7 +130,7 @@ func registerEthKeyCmd(cmd *cli.Cmd) {
return
}

clientCtx, err := client.NewClientContext(*cosmosChainID, valAddress.String(), cosmosKeyring)
clientCtx, err := chainclient.NewClientContext(*cosmosChainID, valAddress.String(), cosmosKeyring)
if err != nil {
log.WithError(err).Fatalln("failed to initialize cosmos client context")
}
Expand All @@ -141,7 +142,7 @@ func registerEthKeyCmd(cmd *cli.Cmd) {
}

clientCtx = clientCtx.WithClient(tmRPC)
daemonClient, err := client.NewCosmosClient(clientCtx, *cosmosGRPC, client.OptionGasPrices(*cosmosGasPrices))
daemonClient, err := chainclient.NewChainClient(clientCtx, *cosmosGRPC, common.OptionGasPrices(*cosmosGasPrices))
if err != nil {
log.WithError(err).WithFields(log.Fields{
"endpoint": *cosmosGRPC,
Expand Down
31 changes: 11 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,43 @@ go 1.16
require (
github.com/DataDog/zstd v1.4.8 // indirect
github.com/InjectiveLabs/etherman v1.7.0
github.com/InjectiveLabs/sdk-go v1.23.4
github.com/InjectiveLabs/metrics v0.0.1
github.com/InjectiveLabs/sdk-go v1.38.2
github.com/StackExchange/wmi v1.2.0 // indirect
github.com/alexcesaro/statsd v2.0.0+incompatible
github.com/avast/retry-go v3.0.0+incompatible
github.com/cosmos/cosmos-sdk v0.43.0-rc1
github.com/cosmos/cosmos-sdk v0.45.2
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/ethereum/go-ethereum v1.10.5
github.com/go-kit/kit v0.11.0 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/golang/glog v0.0.0-20210429001901-424d2337a529 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-multierror v1.1.0
github.com/huin/goupnp v1.0.2 // indirect
github.com/jawher/mow.cli v1.2.0
github.com/karalabe/usb v0.0.0-20210518091819-4ea20957c210 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
github.com/onsi/ginkgo v1.15.1
github.com/onsi/gomega v1.10.1
github.com/onsi/ginkgo v1.16.2
github.com/onsi/gomega v1.13.0
github.com/peterh/liner v1.2.1 // indirect
github.com/pkg/errors v0.9.1
github.com/prometheus/procfs v0.7.0 // indirect
github.com/shirou/gopsutil v3.21.6+incompatible // indirect
github.com/shopspring/decimal v1.2.0
github.com/spf13/cobra v1.2.1 // indirect
github.com/stretchr/testify v1.7.0
github.com/tendermint/tendermint v0.34.11
github.com/tendermint/tendermint v0.34.16
github.com/tklauser/go-sysconf v0.3.7 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/xlab/closer v0.0.0-20190328110542-03326addb7c2
github.com/xlab/suplog v1.3.0
go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
golang.org/x/net v0.0.0-20210716203947-853a461950ff // indirect
google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea // indirect
google.golang.org/grpc v1.39.0
gopkg.in/alexcesaro/statsd.v2 v2.0.0 // indirect
github.com/xlab/suplog v1.3.1
golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e
google.golang.org/grpc v1.44.0
)

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

replace github.com/btcsuite/btcutil => github.com/btcsuite/btcutil v1.0.2

replace github.com/cosmos/cosmos-sdk => github.com/InjectiveLabs/cosmos-sdk v0.43.0-rc0-inj
replace github.com/cosmos/cosmos-sdk => github.com/InjectiveLabs/cosmos-sdk v0.43.0-rc0

replace github.com/ethereum/go-ethereum => github.com/ethereum/go-ethereum v1.10.2
replace github.com/ethereum/go-ethereum => github.com/ethereum/go-ethereum v1.10.5
Loading

0 comments on commit ade8906

Please sign in to comment.