From 93e6e3c52d553fd038b787392906f68ca081ce13 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sat, 24 Feb 2024 04:57:05 +0100 Subject: [PATCH] Remove extra code path in TickToPrice (#7598) (#7603) * Minor CL tick speedups * undo feature for another commit (cherry picked from commit 3c2386a12aa7aa79278c98cfc786b6e1c869b312) Co-authored-by: Dev Ojha --- x/concentrated-liquidity/math/tick.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/x/concentrated-liquidity/math/tick.go b/x/concentrated-liquidity/math/tick.go index 204624f30f6..5acde23de19 100644 --- a/x/concentrated-liquidity/math/tick.go +++ b/x/concentrated-liquidity/math/tick.go @@ -104,19 +104,8 @@ func TickToPrice(tickIndex int64) (osmomath.BigDec, error) { numAdditiveTicks := tickIndex - (geometricExponentDelta * geometricExponentIncrementDistanceInTicks) additiveSpacing := currentAdditiveIncrementInTicks.MulInt64(numAdditiveTicks) - var price osmomath.BigDec - // Finally, we can calculate the price - // Note that to maintain backwards state-compatibility, we utilize the - // original math based on 18 precision decimal on the range of [MinInitializedTick, tick(MaxSpotPrice)] - // For the newly extended range of [MinInitializedTickV2, MinInitializedTick), we use the new math - // based on 36 precision decimal. - // TODO: Delete this code difference, it yields the exact same number every time. - if tickIndex < types.MinInitializedTick { - price = additiveSpacing.AddMut(powTenBigDec(geometricExponentDelta)) - } else { - price = osmomath.BigDecFromDecMut((additiveSpacing.Dec()).AddMut(PowTenInternal(geometricExponentDelta))) - } + price := additiveSpacing.AddMut(powTenBigDec(geometricExponentDelta)) // defense in depth, this logic would not be reached due to use having checked if given tick is in between // min tick and max tick.