From 058e33e8c894a5d499aa4afd31620701064013c1 Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Fri, 23 Feb 2024 21:21:33 -0600 Subject: [PATCH] Remove extra code path in TickToPrice (#7598) * Minor CL tick speedups * undo feature for another commit (cherry picked from commit 3c2386a12aa7aa79278c98cfc786b6e1c869b312) --- 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.