Submitted by josephdara, also found by Rhaydden (1, 2), Tigerfrake, Naresh, Bauchibred, ayden, ZanyBonzy, SBSecurity, kodyvim, WinSec, Kaysoft, Giorgio, jolah1, 0xhashiman, 0xabhay, Sparrow, 0xhere2learn, and grearlake
The function callUniswapObserve is used to get twap price tick using IUniswapV3PoolOracle.observe.selector which is then used to calculate the int24 tick.
The problem is that in case if (tickCumulatives[1] - tickCumulatives[0]) is negative, the tick should be rounded down as its done in the OracleLibrary from uniswap.
As result, in case if (tickCumulatives[1] - tickCumulatives[0])is negative and (tickCumulatives[1] - tickCumulatives[0]) % secondsAgo != 0, then returned tick will be bigger then it should be, hence incorrect prices would be used.
Unihelper:::callUniswapObserve():
In Uniswaps OracleLibrary:::consult():
Solodit
Round down the int24 tick:
Math
syuhei176 (Predy) confirmed via duplicate Issue #65
0xsomeone (judge) commented:
