From af489da2d9bad7f776516a49de86fbd5a492ac2b Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 9 May 2023 13:56:40 +0200 Subject: [PATCH 1/3] feat: default to noop mempool when max-txs is negative --- server/util.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/server/util.go b/server/util.go index bd1b80371ffa..8327a8da06c3 100644 --- a/server/util.go +++ b/server/util.go @@ -487,6 +487,15 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) { cast.ToUint32(appOpts.Get(FlagStateSyncSnapshotKeepRecent)), ) + defaultMempool := baseapp.SetMempool(mempool.NoOpMempool{}) + if maxTxs := cast.ToInt(appOpts.Get(FlagMempoolMaxTxs)); maxTxs >= 0 { + defaultMempool = baseapp.SetMempool( + mempool.NewSenderNonceMempool( + mempool.SenderNonceMaxTxOpt(maxTxs), + ), + ) + } + return []func(*baseapp.BaseApp){ baseapp.SetPruning(pruningOpts), baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(FlagMinGasPrices))), @@ -499,11 +508,7 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) { baseapp.SetSnapshot(snapshotStore, snapshotOptions), baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(FlagIAVLCacheSize))), baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(FlagDisableIAVLFastNode))), - baseapp.SetMempool( - mempool.NewSenderNonceMempool( - mempool.SenderNonceMaxTxOpt(cast.ToInt(appOpts.Get(FlagMempoolMaxTxs))), - ), - ), + defaultMempool, baseapp.SetIAVLLazyLoading(cast.ToBool(appOpts.Get(FlagIAVLLazyLoading))), baseapp.SetChainID(chainID), } From edeac6046c02d5f8a2e89ca4e7d7b749c1422bf7 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 9 May 2023 14:05:44 +0200 Subject: [PATCH 2/3] update docs --- CHANGELOG.md | 1 + docs/docs/run-node/01-run-node.md | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bb3c5911f0e..0a146c2a1753 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* (server) [#](https://github.com/cosmos/cosmos-sdk/pull/) When `mempool.max-txs` is set to a negative value, use a no-op mempool (effectively disable the app mempool). * (simapp) [#15958](https://github.com/cosmos/cosmos-sdk/pull/15958) Refactor SimApp for removing the global basic manager. * (gov) [#15979](https://github.com/cosmos/cosmos-sdk/pull/15979) Improve gov error message when failing to convert v1 proposal to v1beta1. * (crypto) [#3129](https://github.com/cosmos/cosmos-sdk/pull/3129) New armor and keyring key derivation uses aead and encryption uses chacha20poly diff --git a/docs/docs/run-node/01-run-node.md b/docs/docs/run-node/01-run-node.md index 871fd0d2b1ed..c9b3707a3f85 100644 --- a/docs/docs/run-node/01-run-node.md +++ b/docs/docs/run-node/01-run-node.md @@ -124,6 +124,22 @@ One example config to tweak is the `minimum-gas-prices` field inside `app.toml`, minimum-gas-prices = "0stake" ``` +:::tip +When running a node (not a validator!) and not wanting to run the application mempool, set the `max-txs` field to `-1`. + +```toml +[mempool] +# Setting max-txs to 0 will allow for a unbounded amount of transactions in the mempool. +# Setting max_txs to negative 1 (-1) will disable transactions from being inserted into the mempool. +# Setting max_txs to a positive number (> 0) will limit the number of transactions in the mempool, by the specified amount. +# +# Note, this configuration only applies to SDK built-in app-side mempool +# implementations. +max-txs = "-1" +``` + +::: + ## Run a Localnet Now that everything is set up, you can finally start your node: From 3bb801ff4f2c8e6fefe288a66cc4bdc68426279b Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 9 May 2023 17:42:29 +0200 Subject: [PATCH 3/3] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a146c2a1753..435110ee3247 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,7 +69,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements -* (server) [#](https://github.com/cosmos/cosmos-sdk/pull/) When `mempool.max-txs` is set to a negative value, use a no-op mempool (effectively disable the app mempool). +* (server) [#16071](https://github.com/cosmos/cosmos-sdk/pull/16071) When `mempool.max-txs` is set to a negative value, use a no-op mempool (effectively disable the app mempool). * (simapp) [#15958](https://github.com/cosmos/cosmos-sdk/pull/15958) Refactor SimApp for removing the global basic manager. * (gov) [#15979](https://github.com/cosmos/cosmos-sdk/pull/15979) Improve gov error message when failing to convert v1 proposal to v1beta1. * (crypto) [#3129](https://github.com/cosmos/cosmos-sdk/pull/3129) New armor and keyring key derivation uses aead and encryption uses chacha20poly