Skip to content

Commit

Permalink
Merge PR: fix random panic parallel tx (#2794)
Browse files Browse the repository at this point in the history
  • Loading branch information
scf0220 authored Nov 23, 2022
1 parent 27cbd9c commit 312efd9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libs/cosmos-sdk/baseapp/baseapp_parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ func (app *BaseApp) runTxs() []*abci.ResponseDeliverTx {
pm.blockGasMeterMu.Unlock()
// merge tx
pm.SetCurrentIndex(txIndex, res)
pm.finalResult[txIndex] = res

currentGas += uint64(res.resp.GasUsed)
txIndex++
Expand Down Expand Up @@ -335,7 +336,7 @@ func (app *BaseApp) endParallelTxs() [][]byte {
txs := make([]sdk.Tx, app.parallelTxManage.txSize)
app.FeeSplitCollector = make([]*sdk.FeeSplitInfo, 0)
for index := 0; index < app.parallelTxManage.txSize; index++ {
txRes := app.parallelTxManage.txResultCollector.getTxResult(index)
txRes := app.parallelTxManage.finalResult[index]
logIndex[index] = txRes.paraMsg.LogIndex
errs[index] = txRes.paraMsg.AnteErr
hasEnterEvmTx[index] = txRes.paraMsg.HasRunEvmTx
Expand Down Expand Up @@ -617,6 +618,7 @@ type parallelTxManager struct {

extraTxsInfo []*extraDataForTx
txResultCollector *txResultCollector
finalResult []*executeResult

groupList map[int][]int
nextTxInGroup map[int]int
Expand Down Expand Up @@ -745,6 +747,7 @@ func (f *parallelTxManager) init() {
txSize := f.txSize

f.txResultCollector.init(txSize)
f.finalResult = make([]*executeResult, txSize)

txsInfoCap := cap(f.extraTxsInfo)
if f.extraTxsInfo == nil || txsInfoCap < txSize {
Expand Down

0 comments on commit 312efd9

Please sign in to comment.