Submitted by WatchPug
UniswapV2PriceOracle.sol#L62
Because the Solidity version used by the current implementation of UniswapV2OracleLibrary.sol is >=0.8.7, and there are some breaking changes in Solidity v0.8.0:
Ref: https://docs.soliditylang.org/en/v0.8.13/080-breaking-changes.html#silent-changes-of-the-semantics
While in UniswapV2OracleLibrary.sol, subtraction overflow is desired at blockTimestamp - blockTimestampLast in currentCumulativePrices():
https://github.com/Uniswap/v2-periphery/blob/master/contracts/libraries/UniswapV2OracleLibrary.sol#L25-L33
In another word, Uniswap/v2-periphery/contracts/libraries/UniswapV2OracleLibrary only works at solidity < 0.8.0.
As a result, when price0Cumulative or price1Cumulative is big enough, currentCumulativePrices will revert due to overflow.
Since the overflow is desired in the original version, and its broken because of using Solidity version >0.8. The UniswapV2PriceOracle contract will break when the desired overflow happens, and further breaks other parts of the system that relies on UniswapV2PriceOracle.
Note: this recommended fix requires a fork of the library contract provided by Uniswap.
Change to:
jn-lp (Phuture Finance) confirmed and resolved
