Skip to content

Commit

Permalink
Make occ caused evm panics less noisy (#1728)
Browse files Browse the repository at this point in the history
* make occ caused evm panics less noisy

* update comment

* remove prints

* fix

* fix
  • Loading branch information
jewei1997 authored Jun 11, 2024
1 parent 033cf29 commit 6353441
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions x/evm/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
"math"
"math/big"
"runtime/debug"
"strings"

"github.com/armon/go-metrics"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
occtypes "github.com/cosmos/cosmos-sdk/types/occ"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -62,10 +64,11 @@ func (server msgServer) EVMTransaction(goCtx context.Context, msg *types.MsgEVMT

defer func() {
if pe := recover(); pe != nil {
// there is not supposed to be any panic
debug.PrintStack()
ctx.Logger().Error(fmt.Sprintf("EVM PANIC: %s", pe))
telemetry.IncrCounter(1, types.ModuleName, "panics")
if !strings.Contains(fmt.Sprintf("%s", pe), occtypes.ErrReadEstimate.Error()) {
debug.PrintStack()
ctx.Logger().Error(fmt.Sprintf("EVM PANIC: %s", pe))
telemetry.IncrCounter(1, types.ModuleName, "panics")
}
server.AppendErrorToEvmTxDeferredInfo(ctx, tx.Hash(), fmt.Sprintf("%s", pe))

panic(pe)
Expand Down

0 comments on commit 6353441

Please sign in to comment.