Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make occ caused evm panics less noisy #1728

Merged
merged 6 commits into from
Jun 11, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions x/evm/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
"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 @@

defer func() {
if pe := recover(); pe != nil {
// there is not supposed to be any panic
debug.PrintStack()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's put this under the if below as well

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()) {
ctx.Logger().Error(fmt.Sprintf("EVM PANIC: %s", pe))
telemetry.IncrCounter(1, types.ModuleName, "panics")
}

Check warning on line 71 in x/evm/keeper/msg_server.go

View check run for this annotation

Codecov / codecov/patch

x/evm/keeper/msg_server.go#L68-L71

Added lines #L68 - L71 were not covered by tests
server.AppendErrorToEvmTxDeferredInfo(ctx, tx.Hash(), fmt.Sprintf("%s", pe))

panic(pe)
Expand Down
Loading