Skip to content

Commit

Permalink
Reset block gas meter if concurrent processing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
codchen committed May 21, 2023
1 parent 98c60f0 commit 3784d07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,7 @@ func (app *App) ProcessTxs(
// CacheMultiStore where it writes the data to the parent store (DeliverState) in sorted Key order to maintain
// deterministic ordering between validators in the case of concurrent deliverTXs
processBlockCtx, processBlockCache := app.CacheContext(ctx)
blockGasMeterConsumed := processBlockCtx.BlockGasMeter().GasConsumed()
concurrentResults, ok := processBlockConcurrentFunction(
processBlockCtx,
txs,
Expand Down Expand Up @@ -1215,6 +1216,8 @@ func (app *App) ProcessTxs(
dexMemState.Clear(ctx)
dexMemState.ClearContractToDependencies()

ctx.BlockGasMeter().RefundGas(ctx.BlockGasMeter().GasConsumed()-blockGasMeterConsumed, "concurrent failure rollback")

txResults := app.ProcessBlockSynchronous(ctx, txs)
processBlockCache.Write()
return txResults, ctx
Expand Down

0 comments on commit 3784d07

Please sign in to comment.