High · published January 27, 2026
⚡ A little logic hiccup in the `mulDiv(x, y, z)` function could lead to some serious miscalculations! If both your product and divisor are negative, you might just end up with the wrong answer. 😱 Think of it like a restaurant bill: if you accidentally assume the total is always negative when using discounts, you might end up giving your customers too much change! In this case, it’s a math library that’s miscalculating due to incorrect assumptions about signs. This bug could lead to some absolutely devastating rounding errors in your smart contracts! Imagine deploying a contract that calculates financial transactions incorrectly — you could be losing or gaining funds unexpectedly. If you're using the `fixed_div_floor` and `fixed_div_ceil` functions, brace yourself for some wild surprises!
Think of it like a restaurant bill: if you accidentally assume the total is always negative when using discounts, you might end up giving your customers too much change! In this case, it’s a math library that’s miscalculating due to incorrect assumptions about signs. In versions 1.3.0 and 1.4.0 of the `soroban-fixed-point-math` library, the `mulDiv(x, y, z)` function miscalculates outputs when both the intermediate product ($x * y$) and the divisor ($z$) are negative, leading to incorrect rounding behavior in `fixed_div_floor` and `fixed_div_ceil`.
This bug could lead to some absolutely devastating rounding errors in your smart contracts! Imagine deploying a contract that calculates financial transactions incorrectly — you could be losing or gaining funds unexpectedly. If you're using the `fixed_div_floor` and `fixed_div_ceil` functions, brace yourself for some wild surprises! To secure your code, update the `soroban-fixed-point-math` library to versions 1.3.1 or 1.4.1 immediately. Since this affects all signed `FixedPoint` and `SorobanFixedPoint` implementations, make sure to review any contracts utilizing these features for further implications. You've got this! Just follow these steps, and you’ll have your contracts back on track in no time! 🛡️