Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
envestcc committed Jan 7, 2025
1 parent ad330c9 commit 748e4d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
1 change: 0 additions & 1 deletion action/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)

Expand Down
15 changes: 4 additions & 11 deletions state/factory/workingset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 748e4d8

Please sign in to comment.