Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/go_modules/github.com/prometheu…
Browse files Browse the repository at this point in the history
…s/common-0.31.1
  • Loading branch information
mergify[bot] authored Sep 30, 2021
2 parents e40b739 + cc1a1c8 commit e1a49de
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (types) [\#10021](https://github.com/cosmos/cosmos-sdk/pull/10021) Speedup coins.AmountOf(), by removing many intermittent regex calls.
* (rosetta) [\#10001](https://github.com/cosmos/cosmos-sdk/issues/10001) Add documentation for rosetta-cli dockerfile and rename folder for the rosetta-ci dockerfile
* [\#9699](https://github.com/cosmos/cosmos-sdk/pull/9699) Add `:`, `.`, `-`, and `_` as allowed characters in the default denom regular expression.
* [\#10262](https://github.com/cosmos/cosmos-sdk/pull/10262) Remove unnecessary logging in `x/feegrant` simulation.

### Bug Fixes

* (client) [#10226](https://github.com/cosmos/cosmos-sdk/pull/10226) Fix --home flag parsing.
* [#10180](https://github.com/cosmos/cosmos-sdk/issues/10180) Documentation: make references to Cosmos SDK consistent
* (store) [#10218](https://github.com/cosmos/cosmos-sdk/pull/10218) Charge gas even when there are no entries while seeking.
* (x/genutil) [#10104](https://github.com/cosmos/cosmos-sdk/pull/10104) Ensure the `init` command reads the `--home` flag value correctly.
Expand Down
16 changes: 5 additions & 11 deletions client/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ func ReadPersistentCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Cont
clientCtx = clientCtx.WithOutputFormat(output)
}

if clientCtx.HomeDir == "" || flagSet.Changed(flags.FlagHome) {
homeDir, _ := flagSet.GetString(flags.FlagHome)
clientCtx = clientCtx.WithHomeDir(homeDir)
}

if !clientCtx.Simulate || flagSet.Changed(flags.FlagDryRun) {
dryRun, _ := flagSet.GetBool(flags.FlagDryRun)
clientCtx = clientCtx.WithSimulation(dryRun)
Expand Down Expand Up @@ -249,17 +254,6 @@ func readTxCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Context, err
return clientCtx, nil
}

// ReadHomeFlag checks if home flag is changed. If this is a case, we update
// HomeDir field of Client Context.
func ReadHomeFlag(clientCtx Context, cmd *cobra.Command) Context {
if cmd.Flags().Changed(flags.FlagHome) {
rootDir, _ := cmd.Flags().GetString(flags.FlagHome)
clientCtx = clientCtx.WithHomeDir(rootDir)
}

return clientCtx
}

// GetClientQueryContext returns a Context from a command with fields set based on flags
// defined in AddQueryFlagsToCmd. An error is returned if any flag query fails.
//
Expand Down
2 changes: 0 additions & 2 deletions client/keys/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func Test_runListCmd(t *testing.T) {
cmd.SetArgs([]string{
fmt.Sprintf("--%s=%s", flags.FlagHome, tt.kbDir),
fmt.Sprintf("--%s=false", flagListNames),
fmt.Sprintf("--%s=%s", flags.FlagKeyringBackend, keyring.BackendTest),
})

if err := cmd.ExecuteContext(ctx); (err != nil) != tt.wantErr {
Expand All @@ -69,7 +68,6 @@ func Test_runListCmd(t *testing.T) {
cmd.SetArgs([]string{
fmt.Sprintf("--%s=%s", flags.FlagHome, tt.kbDir),
fmt.Sprintf("--%s=true", flagListNames),
fmt.Sprintf("--%s=%s", flags.FlagKeyringBackend, keyring.BackendTest),
})

if err := cmd.ExecuteContext(ctx); (err != nil) != tt.wantErr {
Expand Down
7 changes: 5 additions & 2 deletions simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
cmd.SetOut(cmd.OutOrStdout())
cmd.SetErr(cmd.ErrOrStderr())

initClientCtx = client.ReadHomeFlag(initClientCtx, cmd)
initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags())
if err != nil {
return err
}

initClientCtx, err := config.ReadFromClientConfig(initClientCtx)
initClientCtx, err = config.ReadFromClientConfig(initClientCtx)
if err != nil {
return err
}
Expand Down
2 changes: 0 additions & 2 deletions x/feegrant/simulation/genesis.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package simulation

import (
"fmt"
"math/rand"
"time"

Expand Down Expand Up @@ -74,6 +73,5 @@ func RandomizedGenState(simState *module.SimulationState) {
panic(err)
}

fmt.Printf("Selected randomly generated %s parameters:\n%s\n", feegrant.ModuleName, bz)
simState.GenState[feegrant.ModuleName] = bz
}
2 changes: 0 additions & 2 deletions x/genutil/client/cli/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command {

serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config

clientCtx = client.ReadHomeFlag(clientCtx, cmd)
config.SetRoot(clientCtx.HomeDir)

chainID, _ := cmd.Flags().GetString(flags.FlagChainID)
Expand Down

0 comments on commit e1a49de

Please sign in to comment.