From 1d2858f1b2c121cb558fb83b86811f58f6e5063d Mon Sep 17 00:00:00 2001 From: William Banfield Date: Mon, 21 Mar 2022 16:33:06 -0400 Subject: [PATCH] abci++: remove CheckTx call from PrepareProposal flow --- internal/state/execution.go | 5 ----- internal/state/execution_test.go | 6 +----- types/tx.go | 5 ----- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/internal/state/execution.go b/internal/state/execution.go index 7010010da..4f02092d5 100644 --- a/internal/state/execution.go +++ b/internal/state/execution.go @@ -158,11 +158,6 @@ func (blockExec *BlockExecutor) CreateProposalBlock( blockExec.logger.Debug("error removing transaction from the mempool", "error", err, "tx hash", rtx.Hash()) } } - for _, atx := range txrSet.AddedTxs() { - if err := blockExec.mempool.CheckTx(ctx, atx, nil, mempool.TxInfo{}); err != nil { - blockExec.logger.Error("error adding tx to the mempool", "error", err, "tx hash", atx.Hash()) - } - } itxs := txrSet.IncludedTxs() return state.MakeBlock(height, itxs, commit, evidence, proposerAddr), nil } diff --git a/internal/state/execution_test.go b/internal/state/execution_test.go index 6f2c7e87c..58580e7be 100644 --- a/internal/state/execution_test.go +++ b/internal/state/execution_test.go @@ -773,8 +773,7 @@ func TestPrepareProposalRemoveTxs(t *testing.T) { } // TestPrepareProposalAddedTxsIncluded tests that any transactions marked as ADDED -// in the prepare proposal response are included in the block. The test also -// ensures that any transactions added are also checked into the mempool. +// in the prepare proposal response are included in the block. func TestPrepareProposalAddedTxsIncluded(t *testing.T) { const height = 2 ctx, cancel := context.WithCancel(context.Background()) @@ -793,7 +792,6 @@ func TestPrepareProposalAddedTxsIncluded(t *testing.T) { txs := factory.MakeTenTxs(height) mp := &mpmocks.Mempool{} mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(types.Txs(txs[2:])) - mp.On("CheckTx", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Twice() trs := txsToTxRecords(types.Txs(txs)) trs[0].Action = abci.TxRecord_ADDED @@ -828,8 +826,6 @@ func TestPrepareProposalAddedTxsIncluded(t *testing.T) { require.Equal(t, txs[1], block.Data.Txs[1]) mp.AssertExpectations(t) - mp.AssertCalled(t, "CheckTx", mock.Anything, types.Tx(trs[0].Tx), mock.Anything, mock.Anything) - mp.AssertCalled(t, "CheckTx", mock.Anything, types.Tx(trs[1].Tx), mock.Anything, mock.Anything) } // TestPrepareProposalReorderTxs tests that CreateBlock produces a block with transactions diff --git a/types/tx.go b/types/tx.go index 2dd7d3a51..b81114452 100644 --- a/types/tx.go +++ b/types/tx.go @@ -159,11 +159,6 @@ func (t TxRecordSet) IncludedTxs() []Tx { return t.included } -// AddedTxs returns the transactions added by the application. -func (t TxRecordSet) AddedTxs() []Tx { - return t.added -} - // RemovedTxs returns the transactions marked for removal by the application. func (t TxRecordSet) RemovedTxs() []Tx { return t.removed