From a345815fbe79f63e2ee46143cc196a611d78f59e Mon Sep 17 00:00:00 2001 From: MathisGD Date: Tue, 14 Nov 2023 12:49:20 +0100 Subject: [PATCH] fix: upper value --- src/libraries/MathLib.sol | 4 ++-- test/SpeedJumpIrmTest.sol | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libraries/MathLib.sol b/src/libraries/MathLib.sol index 6cc87f1a..120c7756 100644 --- a/src/libraries/MathLib.sol +++ b/src/libraries/MathLib.sol @@ -22,10 +22,10 @@ library MathLib { /// @dev Above this bound, `wExp` is clipped to avoid overflowing when multiplied with 1 ether. /// @dev This upper bound corresponds to: ln(type(int256).max / 1e36) (scaled by WAD, floored). - int256 internal constant WEXP_UPPER_BOUND = 94.552614875560354586 ether; + int256 internal constant WEXP_UPPER_BOUND = 93.859467695000404319 ether; /// @dev The value of wExp(`WEXP_UPPER_BOUND`). - int256 internal constant WEXP_UPPER_VALUE = 115432178323118442717551238386899909037872.77663603861225472 ether; + int256 internal constant WEXP_UPPER_VALUE = 57716089161558943862588783571184261698504.523000224082296832 ether; /// @dev Returns an approximation of exp. function wExp(int256 x) internal pure returns (int256) { diff --git a/test/SpeedJumpIrmTest.sol b/test/SpeedJumpIrmTest.sol index 49be8ada..1882191b 100644 --- a/test/SpeedJumpIrmTest.sol +++ b/test/SpeedJumpIrmTest.sol @@ -253,9 +253,7 @@ contract AdaptativeCurveIrmTest is Test { function _curve(int256 rateAtTarget, int256 err) internal pure returns (uint256) { // Safe "unchecked" cast because err >= -1 (in WAD). if (err < 0) { - return uint256(((WAD - WAD.wDivDown(CURVE_STEEPNESS)).wMulDown(err) + WAD).wMulDown( - rateAtTarget - )); + return uint256(((WAD - WAD.wDivDown(CURVE_STEEPNESS)).wMulDown(err) + WAD).wMulDown(rateAtTarget)); } else { return uint256(((CURVE_STEEPNESS - WAD).wMulDown(err) + WAD).wMulDown(rateAtTarget)); }