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

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

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -49,6 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Bug Fixes

* (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`.

## [v0.50.0-rc.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.0-rc.0) - 2023-08-18

Expand Down
2 changes: 1 addition & 1 deletion server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions server/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,21 @@
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))

Check failure on line 219 in server/config/config_test.go

View workflow job for this annotation

GitHub Actions / Analyze

SetConfigTemplate(DefaultConfigTemplate) (no value) used as value
require.NoError(t, WriteConfigFile(appConfigFile, defAppConfig))

Check failure on line 220 in server/config/config_test.go

View workflow job for this annotation

GitHub Actions / Analyze

WriteConfigFile(appConfigFile, defAppConfig) (no value) used as value (typecheck)

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)
}
2 changes: 1 addition & 1 deletion server/config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading