Skip to content

Commit

Permalink
Stop returning error logs + stack trace when out of gas in ApplyFuncI…
Browse files Browse the repository at this point in the history
…fNoErr (#2914)

* Stop returning error logs + stack trace when
theres an out of gas in ApplyFuncIfNoErr

* Fix import

* Changelog

(cherry picked from commit 1ec8658)

# Conflicts:
#	CHANGELOG.md
#	osmoutils/cache_ctx.go
  • Loading branch information
ValarDragon authored and mergify[bot] committed Oct 1, 2022
1 parent feab082 commit d35fe48
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 0 deletions.
114 changes: 114 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,121 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

<<<<<<< HEAD
* [2261](https://github.com/osmosis-labs/osmosis/pull/2261) feat: speedup epoch distribution, superfluid component (backport #2214)
=======
### Features

* [#2739](https://github.com/osmosis-labs/osmosis/pull/2739) Add pool type query

### 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

* [#2804](https://github.com/osmosis-labs/osmosis/pull/2804) Improve error handling and messages when parsing pool assets.

## v12.0.0

This release includes several cosmwasm-developer and appchain-ecosystem affecting upgrades:

* TWAP - Time weighted average prices for all AMM pools
* Cosmwasm contract developer facing features
* Enabling select queries for cosmwasm contracts
* Add message responses to gamm messages, to remove the neccessity of bindings
* Allow specifying denom metadata from tokenfactory
* Enabling Interchain accounts (for real this time)
* Upgrading IBC to v3.3.0
* Consistently makes authz work with ledger for all messages

The release also contains the following changes affecting Osmosis users and node operators

* Fixing State Sync
* Enabling expedited proposals

This upgrade also adds a number of safety and API boundary improving changes to the codebase.
While not state machine breaking, this release also includes the revamped Osmosis simulator,
which acts as a fuzz testing tool tailored for the SDK state machine.

### Breaking Changes

* [#2477](https://github.com/osmosis-labs/osmosis/pull/2477) Tokenfactory burn msg clash with sdk
* TypeMsgBurn: from "burn" to "tf_burn"
* TypeMsgMint: from "mint" to "tf_mint"
* [#2222](https://github.com/osmosis-labs/osmosis/pull/2222) Add scaling factors to MsgCreateStableswapPool
* [#1889](https://github.com/osmosis-labs/osmosis/pull/1825) Add proto responses to gamm LP messages:
* MsgJoinPoolResponse: share_out_amount and token_in fields
* MsgExitPoolResponse: token_out field
* [#1825](https://github.com/osmosis-labs/osmosis/pull/1825) Fixes Interchain Accounts (host side) by adding it to AppModuleBasics
* [#1994](https://github.com/osmosis-labs/osmosis/pull/1994) Removed bech32ibc module
* [#2016](https://github.com/osmosis-labs/osmosis/pull/2016) Add fixed 10000 gas cost for each Balancer swap
* [#2193](https://github.com/osmosis-labs/osmosis/pull/2193) Add TwapKeeper to the Osmosis app
* [#2227](https://github.com/osmosis-labs/osmosis/pull/2227) Enable charging fee in base denom for `CreateGauge` and `AddToGauge`.
* [#2283](https://github.com/osmosis-labs/osmosis/pull/2283) x/incentives: refactor `CreateGauge` and `AddToGauge` fees to use txfees denom
* [#2206](https://github.com/osmosis-labs/osmosis/pull/2283) Register all Amino interfaces and concrete types on the authz Amino codec. This will allow the authz module to properly serialize and de-serializes instances using Amino.
* [#2405](https://github.com/osmosis-labs/osmosis/pull/2405) Make SpotPrice have a max value of 2^160, and no longer be able to panic
* [#2473](https://github.com/osmosis-labs/osmosis/pull/2473) x/superfluid `AddNewSuperfluidAsset` now returns error, if any occurs instead of ignoring it.
* [#2714](https://github.com/osmosis-labs/osmosis/pull/2714) Upgrade wasmd to v0.28.0.
* Remove x/Bech32IBC

#### Golang API breaks

* [#2160](https://github.com/osmosis-labs/osmosis/pull/2160) Clean up GAMM keeper (move `x/gamm/keeper/params.go` contents into `x/gamm/keeper/keeper.go`, replace all uses of `PoolNumber` with `PoolId`, move `SetStableSwapScalingFactors` to stableswap package, and delete marshal_bench_test.go and grpc_query_internal_test.go)
* [#1987](https://github.com/osmosis-labs/osmosis/pull/1987) Remove `GammKeeper.GetNextPoolNumberAndIncrement` in favor of the non-mutative `GammKeeper.GetNextPoolNumber`.
* [#1667](https://github.com/osmosis-labs/osmosis/pull/1673) Move wasm-bindings code out of app package into its own root level package.
* [#2013](https://github.com/osmosis-labs/osmosis/pull/2013) Make `SetParams`, `SetPool`, `SetTotalLiquidity`, and `SetDenomLiquidity` GAMM APIs private
* [#1857](https://github.com/osmosis-labs/osmosis/pull/1857) x/mint rename GetLastHalvenEpochNum to GetLastReductionEpochNum
* [#2133](https://github.com/osmosis-labs/osmosis/pull/2133) Add `JoinPoolNoSwap` and `CalcJoinPoolNoSwapShares` to GAMM pool interface and route `JoinPoolNoSwap` in pool_service.go to new method in pool interface
* [#2353](https://github.com/osmosis-labs/osmosis/pull/2353) Re-enable stargate query via whitelsit
* [#2394](https://github.com/osmosis-labs/osmosis/pull/2394) Remove unused interface methods from expected keepers of each module
* [#2390](https://github.com/osmosis-labs/osmosis/pull/2390) x/mint remove unused mintCoins parameter from AfterDistributeMintedCoin
* [#2418](https://github.com/osmosis-labs/osmosis/pull/2418) x/mint remove SetInitialSupplyOffsetDuringMigration from keeper
* [#2417](https://github.com/osmosis-labs/osmosis/pull/2417) x/mint unexport keeper `SetLastReductionEpochNum`, `getLastReductionEpochNum`, `CreateDeveloperVestingModuleAccount`, and `MintCoins`
* [#2587](https://github.com/osmosis-labs/osmosis/pull/2587) remove encoding config argument from NewOsmosisApp
x

### Features

* [#2387](https://github.com/osmosis-labs/osmosis/pull/2387) Upgrade to IBC v3.2.0, which allows for sending/receiving IBC tokens with slashes.
* [#1312] Stableswap: Createpool logic
* [#1230] Stableswap CFMM equations
* [#1429] solver for multi-asset CFMM
* [#1539] Superfluid: Combine superfluid and staking query on querying delegation by delegator
* [#2223] Tokenfactory: Add SetMetadata functionality

### Bug Fixes

* [#2086](https://github.com/osmosis-labs/osmosis/pull/2086) `ReplacePoolIncentivesProposal` ProposalType() returns correct value of `ProposalTypeReplacePoolIncentives` instead of `ProposalTypeUpdatePoolIncentives`
* [1930](https://github.com/osmosis-labs/osmosis/pull/1930) Ensure you can't `JoinPoolNoSwap` tokens that are not in the pool
* [2186](https://github.com/osmosis-labs/osmosis/pull/2186) Remove liquidity event that was emitted twice per message.

### Improvements
* [#2515](https://github.com/osmosis-labs/osmosis/pull/2515) Emit events from functions implementing epoch hooks' `panicCatchingEpochHook` cacheCtx
* [#2526](https://github.com/osmosis-labs/osmosis/pull/2526) EpochHooks interface methods (and hence modules implementing the hooks) return error instead of panic

## v11.0.1

#### Golang API breaks
* [#1893](https://github.com/osmosis-labs/osmosis/pull/1893) Change `EpochsKeeper.SetEpochInfo` to `AddEpochInfo`, which has more safety checks with it. (Makes it suitable to be called within upgrades)
* [#2396](https://github.com/osmosis-labs/osmosis/pull/2396) x/mint remove unused mintCoins parameter from AfterDistributeMintedCoin
* [#2399](https://github.com/osmosis-labs/osmosis/pull/2399) Remove unused interface methods from expected keepers of each module
* [#2401](https://github.com/osmosis-labs/osmosis/pull/2401) Update Go import paths to v11

#### Bug Fixes
* [2291](https://github.com/osmosis-labs/osmosis/pull/2291) Remove liquidity event that was emitted twice per message
* [2288](https://github.com/osmosis-labs/osmosis/pull/2288) Fix swagger docs and swagger generation

## v11

#### Improvements
* [#2237](https://github.com/osmosis-labs/osmosis/pull/2237) Enable charging fee in base denom for `CreateGauge` and `AddToGauge`.

#### SDK Upgrades
* [#2245](https://github.com/osmosis-labs/osmosis/pull/2245) Upgrade SDK for to v0.45.0x-osmo-v9.2. Major changes:
* Minimum deposit on proposer at submission time: https://github.com/osmosis-labs/cosmos-sdk/pull/302
>>>>>>> 1ec86587 (Stop returning error logs + stack trace when out of gas in ApplyFuncIfNoErr (#2914))
## [v7.3.0](https://github.com/osmosis-labs/osmosis/releases/tag/v7.3.0)

Expand Down
27 changes: 27 additions & 0 deletions osmoutils/cache_ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"

"github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand All @@ -30,3 +31,29 @@ func ApplyFuncIfNoError(ctx sdk.Context, f func(ctx sdk.Context) error) (err err
}
return err
}
<<<<<<< HEAD
=======

// PrintPanicRecoveryError error logs the recoveryError, along with the stacktrace, if it can be parsed.
// If not emits them to stdout.
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:
ctx.Logger().Error("recovered (runtime.Error) panic: " + e.Error())
case error:
ctx.Logger().Error("recovered (error) panic: " + e.Error())
default:
ctx.Logger().Error("recovered (default) panic. Could not capture logs in ctx, see stdout")
fmt.Println("Recovering from panic ", recoveryError)
debug.PrintStack()
return
}
ctx.Logger().Error("stack trace: " + errStackTrace)
}
>>>>>>> 1ec86587 (Stop returning error logs + stack trace when out of gas in ApplyFuncIfNoErr (#2914))

0 comments on commit d35fe48

Please sign in to comment.