Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.

Commit 39c86b1

Browse files
authored
fix smb caused by evm AnteErr tx (#3205)
1 parent 68fd8c1 commit 39c86b1

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

libs/cosmos-sdk/baseapp/baseapp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ func (app *BaseApp) getContextForTx(mode runTxMode, txBytes []byte) sdk.Context
703703
// and there is a small probability that NeedUpdateTXCounter() will be wrong
704704
// due to concurrent reading and writing of pm.txIndexMpUpdateTXCounter (slice),
705705
// but such tx will be rerun, so this case can be ignored.
706-
NeedUpdateTXCounter: app.parallelTxManage.NeedUpdateTXCounter(),
706+
HaveCosmosTxInBlock: app.parallelTxManage.NeedUpdateTXCounter(),
707707
CosmosIndexInBlock: app.parallelTxManage.txByteMpCosmosIndex[string(txBytes)],
708708
})
709709
app.parallelTxManage.txByteMpCMIndexLock.RUnlock()

libs/cosmos-sdk/baseapp/baseapp_parallel.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func (app *BaseApp) runTxs() []*abci.ResponseDeliverTx {
255255

256256
if res.paraMsg.AnteErr != nil {
257257
res.msIsNil = true
258-
pm.handleAnteErrTx(res.paraMsg.NeedUpdateTXCounter)
258+
pm.handleAnteErrTx(pm.txIndexMpUpdateTXCounter[pm.upComingTxIndex])
259259
}
260260

261261
pm.deliverTxs[pm.upComingTxIndex] = &res.resp
@@ -852,11 +852,11 @@ func (pm *parallelTxManager) NeedUpdateTXCounter() bool {
852852

853853
// When an AnteErr tx is encountered, this tx will be discarded,
854854
// and the cosmosIndex of the remaining tx needs to be corrected.
855-
func (pm *parallelTxManager) handleAnteErrTx(needUpdateTXCounter bool) {
855+
func (pm *parallelTxManager) handleAnteErrTx(curTxNeedUpdateTXCounter bool) {
856856
pm.haveAnteErrTx = true
857857
pm.txIndexMpUpdateTXCounter[pm.upComingTxIndex] = false
858858

859-
if needUpdateTXCounter {
859+
if curTxNeedUpdateTXCounter {
860860
pm.cosmosTxIndexInBlock--
861861
pm.txByteMpCMIndexLock.Lock()
862862
for index, tx := range pm.txs {

libs/cosmos-sdk/types/context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ func (c *Context) IsDeliverWithSerial() bool {
9292
}
9393

9494
func (c *Context) UseParamCache() bool {
95-
// NeedUpdateTXCounter of E2C tx also is true.
96-
return c.isDeliverWithSerial || (c.paraMsg != nil && !c.paraMsg.NeedUpdateTXCounter) || c.checkTx
95+
// c.paraMsg.HaveCosmosTxInBlock is also true when there are only E2C txs in a block
96+
return c.isDeliverWithSerial || (c.paraMsg != nil && !c.paraMsg.HaveCosmosTxInBlock) || c.checkTx
9797
}
9898

9999
func (c *Context) IsCheckTx() bool { return c.checkTx }

libs/cosmos-sdk/types/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func NewDB(name, dir string) (db dbm.DB, err error) {
9696

9797
type ParaMsg struct {
9898
UseCurrentState bool
99-
NeedUpdateTXCounter bool
99+
HaveCosmosTxInBlock bool
100100
AnteErr error
101101
RefundFee Coins
102102
LogIndex int

0 commit comments

Comments
 (0)