From 1ec86587e464e63cb3634e27b7b3ff42f11c6663 Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Sat, 1 Oct 2022 03:36:47 +0200 Subject: [PATCH] Stop returning error logs + stack trace when out of gas in ApplyFuncIfNoErr (#2914) * Stop returning error logs + stack trace when theres an out of gas in ApplyFuncIfNoErr * Fix import * Changelog --- CHANGELOG.md | 1 + osmoutils/cache_ctx.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4a3e159d67..893532dc099 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes * [#2803](https://github.com/osmosis-labs/osmosis/pull/2803) Fix total pool liquidity CLI query. +* [#2914](https://github.com/osmosis-labs/osmosis/pull/2914) Remove out of gas panics from node logs ### Misc Improvements diff --git a/osmoutils/cache_ctx.go b/osmoutils/cache_ctx.go index 60b382236ca..07941be128f 100644 --- a/osmoutils/cache_ctx.go +++ b/osmoutils/cache_ctx.go @@ -6,6 +6,7 @@ import ( "runtime" "runtime/debug" + "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -40,6 +41,9 @@ func ApplyFuncIfNoError(ctx sdk.Context, f func(ctx sdk.Context) error) (err err func PrintPanicRecoveryError(ctx sdk.Context, recoveryError interface{}) { errStackTrace := string(debug.Stack()) switch e := recoveryError.(type) { + case types.ErrorOutOfGas: + ctx.Logger().Debug("out of gas error inside panic recovery block: " + e.Descriptor) + return case string: ctx.Logger().Error("Recovering from (string) panic: " + e) case runtime.Error: