Blunt Alabaster Kookaburra
Medium
The FullMath
library, adapted for Teller's protocol from Uniswap V3, fails to handle overflows correctly under Solidity ≥0.8.0. This causes execution to revert during critical calculations when intermediate values exceed the 256-bit limit, disrupting the intended functionality of the library.
The original FullMath
library in UniswapV3 was designed for Solidity <0.8.0, where overflows were not automatically checked.
https://github.com/Uniswap/v3-core/blob/main/contracts/libraries/FullMath.sol
But in Teller protocol, the FullMath
library has been adapted from Uniswap V3 for use with Solidity ≥0.8.0.
https://github.com/sherlock-audit/2024-11-teller-finance-update/blob/0c8535728f97d37a4052d2a25909d28db886a422/teller-protocol-v2-audit-2024/packages/contracts/contracts/libraries/uniswap/FullMath.sol#L2
With Solidity ≥0.8.0, overflow checks are enforced, causing reversion in calculations that rely on the "phantom overflow" behavior of the original library.
This effectively means that when a phantom overflow (a multiplication and division where an intermediate value overflows 256 bits) occurs the execution will revert and the correct result won't be returned.
No response
No response
No response
Execution reverts during calculations requiring intermediate overflows
No response
Replace the current FullMath
implementation with the 0.8 version in the Uniswap repository.