Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherry pick for 5 0 1 #908

Merged
merged 1 commit into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
# Changelog

## [Unreleased]
* (gaia) Configure gaiad command to add back `config` capabilities.

## [v5.0.0] - 2021-06-28

Expand Down
8 changes: 5 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"os"
"path/filepath"

"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"

"github.com/gravity-devs/liquidity/x/liquidity"
liquiditykeeper "github.com/gravity-devs/liquidity/x/liquidity/keeper"
Expand All @@ -23,6 +24,8 @@ import (
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"

gaiaappparams "github.com/cosmos/gaia/v5/app/params"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/client/rpc"
Expand Down Expand Up @@ -89,7 +92,6 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
gaiaappparams "github.com/cosmos/gaia/v5/app/params"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"
Expand Down
3 changes: 2 additions & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package gaia

import (
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/gaia/v5/app/params"

"github.com/cosmos/cosmos-sdk/std"
)

// MakeEncodingConfig creates an EncodingConfig for testing
Expand Down
9 changes: 5 additions & 4 deletions app/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import (
"io/ioutil"
"time"

"github.com/pkg/errors"
"github.com/spf13/cobra"
tmjson "github.com/tendermint/tendermint/libs/json"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -23,10 +28,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
ibccoretypes "github.com/cosmos/cosmos-sdk/x/ibc/core/types"
staking "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/pkg/errors"
"github.com/spf13/cobra"
tmjson "github.com/tendermint/tendermint/libs/json"
tmtypes "github.com/tendermint/tendermint/types"
)

const (
Expand Down
7 changes: 4 additions & 3 deletions app/pubkey_replacement.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import (
"io/ioutil"
"log"

"github.com/pkg/errors"
cryptocodec "github.com/tendermint/tendermint/crypto/encoding"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/client"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/genutil/types"
slashing "github.com/cosmos/cosmos-sdk/x/slashing/types"
staking "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/pkg/errors"
cryptocodec "github.com/tendermint/tendermint/crypto/encoding"
tmtypes "github.com/tendermint/tendermint/types"
)

type replacementConfigs []replacementConfig
Expand Down
25 changes: 18 additions & 7 deletions cmd/gaiad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ import (
"os"
"path/filepath"

"github.com/spf13/cast"
"github.com/spf13/cobra"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
"github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/keys"
Expand All @@ -23,11 +30,6 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"github.com/spf13/cast"
"github.com/spf13/cobra"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

gaia "github.com/cosmos/gaia/v5/app"
"github.com/cosmos/gaia/v5/app/params"
Expand All @@ -44,13 +46,21 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
WithLegacyAmino(encodingConfig.Amino).
WithInput(os.Stdin).
WithAccountRetriever(types.AccountRetriever{}).
WithHomeDir(gaia.DefaultNodeHome)
WithHomeDir(gaia.DefaultNodeHome).
WithViper("")

rootCmd := &cobra.Command{
Use: "gaiad",
Short: "Stargate Cosmos Hub App",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
initClientCtx = client.ReadHomeFlag(initClientCtx, cmd)

initClientCtx, err := config.ReadFromClientConfig(initClientCtx)
if err != nil {
return err
}

if err = client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
return err
}

Expand Down Expand Up @@ -79,6 +89,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
tmcli.NewCompletionCmd(rootCmd, true),
testnetCmd(gaia.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
config.Cmd(),
)

server.AddCommands(rootCmd, gaia.DefaultNodeHome, newApp, createSimappAndExport, addModuleInitFlags)
Expand Down
23 changes: 23 additions & 0 deletions cmd/gaiad/cmd/root_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd_test

import (
"testing"

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

app "github.com/cosmos/gaia/v5/app"
"github.com/cosmos/gaia/v5/cmd/gaiad/cmd"
"github.com/stretchr/testify/require"
)

func TestRootCmdConfig(t *testing.T) {

rootCmd, _ := cmd.NewRootCmd()
rootCmd.SetArgs([]string{
"config", // Test the config cmd
"keyring-backend", // key
"test", // value
})

require.NoError(t, svrcmd.Execute(rootCmd, app.DefaultNodeHome))
}