fix(config): mempool.max-txs configuration is invalid (#17649)

This commit is contained in:
zakir 2023-09-07 13:40:17 +08:00 committed by GitHub
parent 7ff1ae999a
commit b094b65aa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 2 deletions

View File

@ -56,6 +56,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (types) [#16583](https://github.com/cosmos/cosmos-sdk/pull/16583), [#17372](https://github.com/cosmos/cosmos-sdk/pull/17372) Add `MigrationModuleManager` to handle migration of upgrade module before other modules, ensuring access to the updated context with consensus parameters within the same block that executes the migration.
* (baseapp) [#17518](https://github.com/cosmos/cosmos-sdk/pull/17518) Utilizing voting power from vote extensions (CometBFT) instead of the current bonded tokens (x/staking) to determine if a set of vote extensions are valid.
* (config) [#17649](https://github.com/cosmos/cosmos-sdk/pull/17649) Fix `mempool.max-txs` configuration is invalid in `app.config`.
### API Breaking Changes

View File

@ -166,7 +166,7 @@ type MempoolConfig struct {
// the mempool is disabled entirely, zero indicates that the mempool is
// unbounded in how many txs it may contain, and a positive value indicates
// the maximum amount of txs it may contain.
MaxTxs int
MaxTxs int `mapstructure:"max-txs"`
}
// State Streaming configuration

View File

@ -212,3 +212,21 @@ func TestSetConfigTemplate(t *testing.T) {
actual := setBuffer.String()
require.Equal(t, expected, actual, "resulting config strings")
}
func TestAppConfig(t *testing.T) {
appConfigFile := filepath.Join(t.TempDir(), "app.toml")
defer func() {
_ = os.Remove(appConfigFile)
}()
defAppConfig := DefaultConfig()
require.NoError(t, SetConfigTemplate(DefaultConfigTemplate))
require.NoError(t, WriteConfigFile(appConfigFile, defAppConfig))
v := viper.New()
v.SetConfigFile(appConfigFile)
require.NoError(t, v.ReadInConfig())
appCfg := new(Config)
require.NoError(t, v.Unmarshal(appCfg))
require.EqualValues(t, appCfg, defAppConfig)
}

View File

@ -234,7 +234,7 @@ stop-node-on-err = {{ .Streaming.ABCI.StopNodeOnErr }}
#
# Note, this configuration only applies to SDK built-in app-side mempool
# implementations.
max-txs = "{{ .Mempool.MaxTxs }}"
max-txs = {{ .Mempool.MaxTxs }}
`
var configTemplate *template.Template