Skip to content

Commit

Permalink
Problem: sdk mempool can't be disabled
Browse files Browse the repository at this point in the history
Solution:
- respect the max-txs config as sdk

changelog
  • Loading branch information
yihuang committed Sep 12, 2024
1 parent a6c9d58 commit ad652d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* (app)[#1564](https://github.com/crypto-org-chain/cronos/pull/1564) Fix mempool data race.
* [#1568](https://github.com/crypto-org-chain/cronos/pull/1568) Update cometbft to 0.38.12.
* [#1570](https://github.com/crypto-org-chain/cronos/pull/1570) Integrate pre-estimate block-stm option to improve worst case performance.
* [#]() Allow disable sdk mempool by setting mempool.max-txs to `-1`.

### Bug Fixes

Expand Down
19 changes: 5 additions & 14 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ import (
evmante "github.com/evmos/ethermint/app/ante"
evmenc "github.com/evmos/ethermint/encoding"
"github.com/evmos/ethermint/ethereum/eip712"
servercfg "github.com/evmos/ethermint/server/config"
srvflags "github.com/evmos/ethermint/server/flags"
ethermint "github.com/evmos/ethermint/types"
"github.com/evmos/ethermint/x/evm"
Expand Down Expand Up @@ -364,24 +363,16 @@ func New(

eip712.SetEncodingConfig(encodingConfig)

// NOTE we use custom transaction decoder that supports the sdk.Tx interface instead of sdk.StdTx
// Setup Mempool and Proposal Handlers
baseAppOptions = append(baseAppOptions, func(app *baseapp.BaseApp) {
maxTxs := cast.ToInt(appOpts.Get(server.FlagMempoolMaxTxs))
if maxTxs <= 0 {
maxTxs = servercfg.DefaultMaxTxs
}
if maxTxs := cast.ToInt(appOpts.Get(server.FlagMempoolMaxTxs)); maxTxs >= 0 {
// NOTE we use custom transaction decoder that supports the sdk.Tx interface instead of sdk.StdTx
// Setup Mempool and Proposal Handlers
mempool := mempool.NewPriorityMempool(mempool.PriorityNonceMempoolConfig[int64]{
TxPriority: mempool.NewDefaultTxPriority(),
SignerExtractor: evmapp.NewEthSignerExtractionAdapter(mempool.NewDefaultSignerExtractionAdapter()),
MaxTx: maxTxs,
})
handler := baseapp.NewDefaultProposalHandler(mempool, app)

app.SetMempool(mempool)
app.SetPrepareProposal(handler.PrepareProposalHandler())
app.SetProcessProposal(handler.ProcessProposalHandler())
})
baseAppOptions = append(baseAppOptions, baseapp.SetMempool(mempool))
}

blockSTMEnabled := cast.ToString(appOpts.Get(srvflags.EVMBlockExecutor)) == "block-stm"

Expand Down

0 comments on commit ad652d0

Please sign in to comment.