diff --git a/action/const.go b/action/const.go index 8d32c92f07..37ed32d4c6 100644 --- a/action/const.go +++ b/action/const.go @@ -44,7 +44,6 @@ var ( ErrGasTipOverFeeCap = errors.New("tip cap is greater than fee cap") ErrMissRequiredField = errors.New("missing required field") ErrValueVeryHigh = errors.New("value is very high") - ErrPanic = errors.New("panic") ErrPanicButReverted = errors.New("panic but reverted") ) diff --git a/state/factory/workingset.go b/state/factory/workingset.go index 15149c964e..c3d7d92d7e 100644 --- a/state/factory/workingset.go +++ b/state/factory/workingset.go @@ -209,20 +209,13 @@ func (ws *workingSet) runAction( defer ws.ResetSnapshots() sn := ws.Snapshot() defer func() { - if err != nil { + if r := recover(); r != nil { + receipt = nil if e := ws.Revert(sn); e != nil { - log.T(ctx).Error("Failed to revert snapshot", zap.Error(e)) + err = errors.Wrapf(e, "panic and recovered but failed to revert when running action: %v", r) return } - if errors.Is(err, action.ErrPanic) { - err = errors.Wrap(action.ErrPanicButReverted, err.Error()) - } - } - }() - defer func() { - if r := recover(); r != nil { - receipt = nil - err = errors.Wrapf(action.ErrPanic, "panic and reverted when running action: %v", r) + err = errors.Wrapf(action.ErrPanicButReverted, "panic and reverted when running action: %v", r) } }() if err := ws.freshAccountConversion(ctx, &actCtx); err != nil {