Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into tip/accounts/module
Browse files Browse the repository at this point in the history
# Conflicts:
#	tests/starship/tests/go.mod
  • Loading branch information
unknown unknown committed Nov 3, 2023
2 parents 8a992d1 + cd19bac commit 2348ca7
Show file tree
Hide file tree
Showing 72 changed files with 900 additions and 810 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* (client/server) [#18345](https://github.com/cosmos/cosmos-sdk/pull/18345) Consistently set viper prefix in client and server. It defaults for the binary name for both client and server.
* (server) [#18254](https://github.com/cosmos/cosmos-sdk/pull/18254) Don't hardcode gRPC address to localhost.
* (x/slashing) [#18016](https://github.com/cosmos/cosmos-sdk/pull/18016) Fixed builder function for missed blocks key (`validatorMissedBlockBitArrayPrefixKey`) in slashing/migration/v4
* (x/gov) [#17873](https://github.com/cosmos/cosmos-sdk/pull/17873) Fail any inactive and active proposals whose messages cannot be decoded.
Expand Down
2 changes: 1 addition & 1 deletion api/cosmos/gov/v1/gov.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions client/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

const (
chainID = "test-chain"
nodeEnv = "NODE"
nodeEnv = "CONFIG_TEST_NODE"
testNode1 = "http://localhost:1"
testNode2 = "http://localhost:2"
)
Expand All @@ -44,13 +44,15 @@ func initClientContextWithTemplate(t *testing.T, envVar, customTemplate string,
WithCodec(codec.NewProtoCodec(codectypes.NewInterfaceRegistry())).
WithChainID(chainID)

require.NoError(t, clientCtx.Viper.BindEnv(nodeEnv))
if envVar != "" {
require.NoError(t, os.Setenv(nodeEnv, envVar))
}

clientCtx, err := config.CreateClientConfig(clientCtx, customTemplate, customConfig)
return clientCtx, func() { _ = os.RemoveAll(home) }, err
return clientCtx, func() {
_ = os.RemoveAll(home)
_ = os.Unsetenv(nodeEnv)
}, err
}

func TestCustomTemplateAndConfig(t *testing.T) {
Expand Down Expand Up @@ -90,7 +92,6 @@ note = "{{ .Note }}"
clientCtx, cleanup, err := initClientContextWithTemplate(t, "", customClientConfigTemplate, customClientConfig)
defer func() {
cleanup()
_ = os.Unsetenv(nodeEnv)
}()

require.NoError(t, err)
Expand All @@ -103,7 +104,6 @@ note = "{{ .Note }}"
_, cleanup, err := initClientContextWithTemplate(t, "", "", customClientConfig)
defer func() {
cleanup()
_ = os.Unsetenv(nodeEnv)
}()

require.Error(t, err)
Expand All @@ -113,7 +113,6 @@ note = "{{ .Note }}"
clientCtx, cleanup, err := initClientContextWithTemplate(t, "", config.DefaultClientConfigTemplate, customClientConfig)
defer func() {
cleanup()
_ = os.Unsetenv(nodeEnv)
}()

require.NoError(t, err)
Expand All @@ -125,7 +124,6 @@ note = "{{ .Note }}"
clientCtx, cleanup, err := initClientContextWithTemplate(t, "", "", nil)
defer func() {
cleanup()
_ = os.Unsetenv(nodeEnv)
}()

require.NoError(t, err)
Expand Down Expand Up @@ -166,7 +164,6 @@ func TestConfigCmdEnvFlag(t *testing.T) {
clientCtx, cleanup := initClientContext(t, tc.envVar)
defer func() {
cleanup()
_ = os.Unsetenv(nodeEnv)
}()

/*
Expand Down
9 changes: 9 additions & 0 deletions client/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"fmt"
"io"
"os"
"path"
"strings"

"github.com/cosmos/gogoproto/proto"
"github.com/spf13/viper"
Expand Down Expand Up @@ -280,7 +282,14 @@ func (ctx Context) WithInterfaceRegistry(interfaceRegistry codectypes.InterfaceR
// client-side config from the config file.
func (ctx Context) WithViper(prefix string) Context {
v := viper.New()

if prefix == "" {
executableName, _ := os.Executable()
prefix = path.Base(executableName)
}

v.SetEnvPrefix(prefix)
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_", "-", "_"))
v.AutomaticEnv()
ctx.Viper = v
return ctx
Expand Down
1 change: 1 addition & 0 deletions client/debug/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func getCodecInterfaceImpls() *cobra.Command {
Short: "List the registered type URLs for the provided interface",
Long: "List the registered type URLs that can be used for the provided interface name using the application codec",
Example: fmt.Sprintf("%s debug codec list-implementations cosmos.crypto.PubKey", version.AppName),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
impls := clientCtx.Codec.InterfaceRegistry().ListImplementations(args[0])
Expand Down
3 changes: 1 addition & 2 deletions client/tx/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/cosmos/go-bip39"
"github.com/spf13/pflag"
"github.com/spf13/viper"

"cosmossdk.io/math"

Expand Down Expand Up @@ -50,7 +49,7 @@ type Factory struct {
// NewFactoryCLI creates a new Factory.
func NewFactoryCLI(clientCtx client.Context, flagSet *pflag.FlagSet) (Factory, error) {
if clientCtx.Viper == nil {
clientCtx.Viper = viper.New()
clientCtx = clientCtx.WithViper("")
}

if err := clientCtx.Viper.BindPFlags(flagSet); err != nil {
Expand Down
3 changes: 1 addition & 2 deletions client/v2/autocli/app.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package autocli

import (
"github.com/cosmos/gogoproto/proto"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/protobuf/reflect/protoregistry"
Expand Down Expand Up @@ -66,7 +65,7 @@ func (appOptions AppOptions) EnhanceRootCommand(rootCmd *cobra.Command) error {
builder := &Builder{
Builder: flag.Builder{
TypeResolver: protoregistry.GlobalTypes,
FileResolver: proto.HybridResolver,
FileResolver: appOptions.ClientCtx.InterfaceRegistry,
Keyring: appOptions.Keyring,
AddressCodec: appOptions.ClientCtx.AddressCodec,
ValidatorAddressCodec: appOptions.ClientCtx.ValidatorAddressCodec,
Expand Down
22 changes: 11 additions & 11 deletions client/v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ require (
cosmossdk.io/core v0.12.0
cosmossdk.io/depinject v1.0.0-alpha.4
cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000
cosmossdk.io/x/tx v0.11.0
cosmossdk.io/x/tx v0.12.0
github.com/cockroachdb/errors v1.11.1
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.51.0
github.com/cosmos/gogoproto v1.4.11
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
google.golang.org/grpc v1.59.0
Expand All @@ -25,7 +24,7 @@ require (
cosmossdk.io/errors v1.0.0 // indirect
cosmossdk.io/log v1.2.1 // indirect
cosmossdk.io/math v1.1.3-rc.1 // indirect
cosmossdk.io/store v1.0.0-rc.0 // indirect
cosmossdk.io/store v1.0.0 // indirect
cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
Expand All @@ -38,7 +37,7 @@ require (
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230824192853-9bb0864bdb98 // indirect
github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft v0.38.0 // indirect
Expand All @@ -47,7 +46,8 @@ require (
github.com/cosmos/cosmos-db v1.0.0 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.0.0-rc.1 // indirect
github.com/cosmos/gogoproto v1.4.11 // indirect
github.com/cosmos/iavl v1.0.0 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
Expand All @@ -63,7 +63,7 @@ require (
github.com/fatih/color v1.15.0 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.23.0 // indirect
github.com/getsentry/sentry-go v0.25.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
Expand Down Expand Up @@ -96,7 +96,7 @@ require (
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.7 // indirect
Expand All @@ -110,16 +110,16 @@ require (
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20230110094441-db37f07504ce // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/petermattis/goid v0.0.0-20230808133559-b036b712a89b // indirect
github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/cors v1.8.3 // indirect
Expand Down
Loading

0 comments on commit 2348ca7

Please sign in to comment.