Skip to content

Commit

Permalink
Revert "feat: add flag to enable price-feeder start as a separate pro…
Browse files Browse the repository at this point in the history
…cess (#179)" (#180)

This reverts commit 0626f18.
  • Loading branch information
mikebraver authored Sep 6, 2024
1 parent a24765d commit cd7d071
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 100 deletions.
36 changes: 3 additions & 33 deletions cmd/exocored/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"fmt"
"io"
"os"
"os/exec"
"path"
"path/filepath"
"time"

Expand Down Expand Up @@ -55,17 +53,7 @@ import (
)

const (
EnvPrefix = "EXOCORE"
cmdStartName = "start"

flagOracle = "oracle"
flagMnemonic = "mnemonic"
confPath = "config"
confOracle = "oracle_feeder.yaml"
feederBianry = "price-feeder"
flagFeederMnemonic = "--mnemonic"
flagFeederConfig = "--config"
flagFeederSource = "--sources"
EnvPrefix = "EXOCORE"
)

// NewRootCmd creates a new root command for exocored. It is called once in the
Expand Down Expand Up @@ -108,6 +96,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
return err
}

// override the app and tendermint configuration
customAppTemplate, customAppConfig := initAppConfig()
customTMConfig := initTendermintConfig()
Expand Down Expand Up @@ -143,26 +132,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
a.appExport,
addModuleInitFlags,
)
startCmd, _, _ := rootCmd.Find([]string{cmdStartName})
startCmd.Flags().Bool(flagOracle, false, "enable oracle feeder")
startCmd.Flags().String(flagMnemonic, "", "set validator consensus key's mnemonic")
preRunE := startCmd.PreRunE
// add preRun to run price-feeder first before starting the node
startCmd.PreRunE = func(cmd *cobra.Command, args []string) error {
if enableOracle, _ := cmd.Flags().GetBool(flagOracle); enableOracle {
mnemonic, _ := cmd.Flags().GetString(flagMnemonic)
clientCtx := cmd.Context().Value(client.ClientContextKey).(*client.Context)
//nolint:gosec
// nosemgrep
cmdFeeder := exec.Command(path.Join(clientCtx.HomeDir, feederBianry), flagFeederConfig, path.Join(clientCtx.HomeDir, confPath, confOracle), flagFeederSource, path.Join(clientCtx.HomeDir, confPath), flagFeederMnemonic, mnemonic, cmdStartName)
cmdFeeder.Stdout = os.Stdout
cmdFeeder.Stderr = os.Stderr
if err := cmdFeeder.Start(); err != nil {
panic(err)
}
}
return preRunE(cmd, args)
}

// add keybase, auxiliary RPC, query, and tx child commands
rootCmd.AddCommand(
rpc.StatusCommand(),
Expand Down
36 changes: 15 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
cosmossdk.io/math v1.2.0
cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d
cosmossdk.io/tools/rosetta v0.2.1
github.com/ExocoreNetwork/price-feeder v0.1.4
github.com/agiledragon/gomonkey/v2 v2.11.0
github.com/armon/go-metrics v0.4.1
github.com/cometbft/cometbft v0.37.4
Expand All @@ -29,10 +28,10 @@ require (
github.com/prysmaticlabs/prysm/v4 v4.2.1
github.com/rakyll/statik v0.1.7
github.com/smartystreets/goconvey v1.6.4
github.com/spf13/cast v1.6.0
github.com/spf13/cobra v1.8.0
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
go.opencensus.io v0.24.0
go.uber.org/mock v0.4.0
Expand All @@ -50,7 +49,7 @@ require (
cosmossdk.io/api v0.3.1
github.com/btcsuite/btcd v0.23.3 // indirect
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
Expand All @@ -67,7 +66,7 @@ require (
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.5 // indirect
cloud.google.com/go/storage v1.35.1 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
cosmossdk.io/core v0.6.1 // indirect
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
cosmossdk.io/log v1.3.0 // indirect
Expand Down Expand Up @@ -112,7 +111,7 @@ require (
github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
github.com/getsentry/sentry-go v0.23.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
Expand All @@ -121,7 +120,7 @@ require (
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
Expand Down Expand Up @@ -153,7 +152,7 @@ require (
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
github.com/herumi/bls-eth-go-binary v0.0.0-20210917013441-d37c07cfda4e // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand Down Expand Up @@ -183,9 +182,9 @@ require (
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
github.com/petermattis/goid v0.0.0-20230518223814-80aa455d8761 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
Expand All @@ -198,16 +197,14 @@ require (
github.com/rjeczalik/notify v0.9.3 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/zerolog v1.31.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
Expand All @@ -226,16 +223,13 @@ require (
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/api v0.153.0 // indirect
google.golang.org/api v0.149.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect
Expand Down
Loading

0 comments on commit cd7d071

Please sign in to comment.