forked from cerc-io/laconicd-deprecated
fix(evm): clear logs if tx failed in post processing hooks (#1128)
* Problem: clear logs if tx failed in post processing hooks * Update x/evm/keeper/state_transition.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Federico Kunze Küllmer
parent
5e55e5c444
commit
6cf2b9fdd3
@@ -599,6 +599,7 @@ func (suite *EvmTestSuite) TestERC20TransferReverted() {
|
||||
|
||||
suite.Require().True(res.Failed())
|
||||
suite.Require().Equal(tc.expErr, res.VmError)
|
||||
suite.Require().Empty(res.Logs)
|
||||
|
||||
after := k.GetBalance(suite.ctx, suite.from)
|
||||
|
||||
|
||||
@@ -268,6 +268,9 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*t
|
||||
// If hooks return error, revert the whole tx.
|
||||
res.VmError = types.ErrPostTxProcessing.Error()
|
||||
k.Logger(ctx).Error("tx post processing failed", "error", err)
|
||||
|
||||
// If the tx failed in post processing hooks, we should clear the logs
|
||||
res.Logs = nil
|
||||
} else if commit != nil {
|
||||
// PostTxProcessing is successful, commit the tmpCtx
|
||||
commit()
|
||||
|
||||
Reference in New Issue
Block a user