Skip to content

Conversation

cloudgray
Copy link
Contributor

Description

Fix CheckTxHandler to allow tx with "invalid sequence" error.

The purpose of this pr is aligning appside mempool with geth mempool.

Because current anteHandler rejects valid tx whose nonce is lower than tx in mempool, CheckTxHandler should handle this error and insert that tx into mempool.

The reason why does not modify anteHandler but CheckTxHandler is, if appside mempool is not enabled, validation of anteHandler is correct. So, we should modify CheckTxHandler that is used for appside mempool.

Closes: #590


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

@cloudgray cloudgray marked this pull request as ready for review September 9, 2025 10:49
@cloudgray cloudgray requested review from a team as code owners September 9, 2025 10:49
@cloudgray cloudgray changed the title fix(mempool): checkTxHandler handles "invalid nonce" tx fix(mempool): checkTxHandler should handle "invalid nonce" tx Sep 9, 2025
@cloudgray cloudgray changed the title fix(mempool): checkTxHandler should handle "invalid nonce" tx fix(mempool): checkTxHandler to handle invalid sequence tx Sep 9, 2025
@cloudgray cloudgray requested a review from vladjdk September 11, 2025 05:41
@vladjdk vladjdk self-assigned this Sep 12, 2025
@@ -18,7 +18,7 @@ func NewCheckTxHandler(mempool *ExperimentalEVMMempool) types.CheckTxHandler {
gInfo, result, anteEvents, err := runTx(request.Tx, nil)
if err != nil {
// detect if there is a nonce gap error (only returned for EVM transactions)
if errors.Is(err, ErrNonceGap) {
if errors.Is(err, ErrNonceGap) || errors.Is(err, sdkerrors.ErrInvalidSequence) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a test that confirms that transactions that have already been included in a block will not be included in the mempool?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix(mempool): CheckTxHandler should handle tx with "invalid sequence" error
2 participants