diff --git a/test/invariant/Invariants.t.sol b/test/invariant/Invariants.t.sol index 5f67a3b..f0ff9ee 100644 --- a/test/invariant/Invariants.t.sol +++ b/test/invariant/Invariants.t.sol @@ -85,11 +85,11 @@ abstract contract PSMInvariantTestBase is PSMTestBase { // LPs position value can increase from transfers into the PSM and from swapping rounding // errors increasing the value of the PSM slightly. - // Allow a 4 tolerance for negative rounding on conversion calculations. - assertGe(lpAssetValue + 1e12, lpDeposits); + // Allow a 2e12 tolerance for negative rounding on conversion calculations. + assertGe(lpAssetValue + 2e12, lpDeposits); - // Include seed deposit, allow for 1e12 negative tolerance. - assertGe(psm.getPsmTotalValue() + 1e12, lpDeposits); + // Include seed deposit, allow for 2e12 negative tolerance. + assertGe(psm.getPsmTotalValue() + 2e12, lpDeposits); } function _checkInvariant_E() public view { diff --git a/test/invariant/handlers/SwapperHandler.sol b/test/invariant/handlers/SwapperHandler.sol index 9eec1a6..150b5cc 100644 --- a/test/invariant/handlers/SwapperHandler.sol +++ b/test/invariant/handlers/SwapperHandler.sol @@ -138,13 +138,16 @@ contract SwapperHandler is HandlerBase { "SwapperHandler/swap/conversion-rate-million-decrease" ); - // Position values can fluctuate by up to 0.00000002% on swaps - assertApproxEqRel( - psm.convertToAssetValue(psm.shares(lp0)), - startingConversionLp0, - 0.000002e18, - "SwapperHandler/swap/conversion-rate-change-lp" - ); + // Disregard this assertion if the LP has less than a dollar of value + if (startingConversionLp0 > 1e18) { + // Position values can fluctuate by up to 0.00000002% on swaps + assertApproxEqRel( + psm.convertToAssetValue(psm.shares(lp0)), + startingConversionLp0, + 0.000002e18, + "SwapperHandler/swap/conversion-rate-change-lp" + ); + } // Decrease in value from rounding is capped at 2e12 assertGe(