Skip to content

Commit

Permalink
add post tx process in evm call
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Nov 4, 2023
1 parent ba64397 commit b91a861
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion x/fungible/keeper/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,9 +649,21 @@ func (k Keeper) CallEVMWithData(
if err != nil {
return nil, err
}
logs := evmtypes.LogsToEthereum(res.Logs)

if res.Failed() {
return res, cosmoserrors.Wrap(evmtypes.ErrVMExecution, fmt.Sprintf("%s: ret 0x%x", res.VmError, res.Ret))
} else {

Check warning on line 656 in x/fungible/keeper/evm.go

View workflow job for this annotation

GitHub Actions / lint

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)
// call PostTxProcessing hook
receipt := &ethtypes.Receipt{
Logs: logs,
TxHash: common.HexToHash(res.Hash),
}
if err = k.evmKeeper.PostTxProcessing(ctx, msg, receipt); err != nil {
// if post-processing return error, revert the whole tx
k.Logger(ctx).Error("tx post processing failed", "error", err)
return nil, cosmoserrors.Wrap(evmtypes.ErrPostTxProcessing, err.Error())
}
}

// Emit events and log for the transaction if it is committed
Expand Down Expand Up @@ -715,7 +727,6 @@ func (k Keeper) CallEVMWithData(
})
}

logs := evmtypes.LogsToEthereum(res.Logs)
var bloomReceipt ethtypes.Bloom
if len(logs) > 0 {
bloom := k.evmKeeper.GetBlockBloomTransient(ctx)
Expand Down

0 comments on commit b91a861

Please sign in to comment.