Skip to content

Commit

Permalink
Change Execute Method to cosmos-sdk (#666)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattverse authored Dec 19, 2021
1 parent 4cdd83f commit 74e5932
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Minor improvements & Bug Fixes

- [#666](https://github.com/osmosis-labs/osmosis/pull/666) Fix the `--log-level` and `--log-format` commands on `osmosisd start`
- [#655](https://github.com/osmosis-labs/osmosis/pull/655) Make the default genesis for pool-incentives work by default
- [97ac2a8](https://github.com/osmosis-labs/osmosis/commit/97ac2a86303fc8966a4c169107e0945775107e67) Fix InitGenesis bug for gauges

Expand Down
17 changes: 0 additions & 17 deletions cmd/osmosisd/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cmd

import (
"context"
"io"
"os"
"path/filepath"
Expand Down Expand Up @@ -134,22 +133,6 @@ lru_size = 0`
return customAppTemplate, customAppConfig
}

// Execute executes the root command.
func Execute(rootCmd *cobra.Command) error {
// Create and set a client.Context on the command's Context. During the pre-run
// of the root command, a default initialized client.Context is provided to
// seed child command execution with values such as AccountRetriver, Keyring,
// and a Tendermint RPC. This requires the use of a pointer reference when
// getting and setting the client.Context. Ideally, we utilize
// https://github.com/spf13/cobra/pull/1118.
ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, &client.Context{})
ctx = context.WithValue(ctx, server.ServerContextKey, server.NewDefaultContext())

executor := tmcli.PrepareBaseCmd(rootCmd, "", osmosis.DefaultNodeHome)
return executor.ExecuteContext(ctx)
}

func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {

cfg := sdk.GetConfig()
Expand Down
5 changes: 4 additions & 1 deletion cmd/osmosisd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ package main
import (
"os"

svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"

osmosis "github.com/osmosis-labs/osmosis/app"
"github.com/osmosis-labs/osmosis/app/params"
"github.com/osmosis-labs/osmosis/cmd/osmosisd/cmd"
)

func main() {
params.SetAddressPrefixes()
rootCmd, _ := cmd.NewRootCmd()
if err := cmd.Execute(rootCmd); err != nil {
if err := svrcmd.Execute(rootCmd, osmosis.DefaultNodeHome); err != nil {
os.Exit(1)
}
}

0 comments on commit 74e5932

Please sign in to comment.