Skip to content

Commit

Permalink
Fix deliverTxer not including ante events on failed txns
Browse files Browse the repository at this point in the history
  • Loading branch information
leeyikjiun committed Feb 7, 2022
1 parent 2bc99b1 commit 6c7e457
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,13 @@ func (app *BaseApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
// Otherwise, the ResponseDeliverTx will contain releveant error information.
// Regardless of tx execution outcome, the ResponseDeliverTx will contain relevant
// gas execution context.
func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx {
func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx) {
defer telemetry.MeasureSince(time.Now(), "abci", "deliver_tx")
defer func() {
if app.deliverTxer != nil {
app.deliverTxer(app.deliverState.ctx, req, res)
}
}()

gInfo := sdk.GasInfo{}
resultStr := "successful"
Expand All @@ -279,19 +284,13 @@ func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx
return sdkerrors.ResponseDeliverTxWithEvents(err, gInfo.GasWanted, gInfo.GasUsed, anteEvents, app.trace)
}

txResult := abci.ResponseDeliverTx{
return abci.ResponseDeliverTx{
GasWanted: int64(gInfo.GasWanted), // TODO: Should type accept unsigned ints?
GasUsed: int64(gInfo.GasUsed), // TODO: Should type accept unsigned ints?
Log: result.Log,
Data: result.Data,
Events: sdk.MarkEventsToIndex(result.Events, app.indexEvents),
}

if app.deliverTxer != nil {
app.deliverTxer(app.deliverState.ctx, req, txResult)
}

return txResult
}

// Commit implements the ABCI interface. It will commit all state that exists in
Expand Down

0 comments on commit 6c7e457

Please sign in to comment.