diff --git a/foundry.toml b/foundry.toml index 7cc053d2d..a16eb50d1 100644 --- a/foundry.toml +++ b/foundry.toml @@ -8,6 +8,14 @@ evm_version = "cancun" gas_limit = "300000000" bytecode_hash = "none" +additional_compiler_profiles = [ + { name = "test", via_ir = false } +] + +compilation_restrictions = [ + { paths = "**/test/**", via_ir = false }, +] + [profile.default.fuzz] runs = 1000 seed = "0x4444" diff --git a/snapshots/CustomAccountingTest.json b/snapshots/CustomAccountingTest.json index 348909c5f..e1726eded 100644 --- a/snapshots/CustomAccountingTest.json +++ b/snapshots/CustomAccountingTest.json @@ -1,6 +1,6 @@ { - "addLiquidity CA fee": "170695", - "removeLiquidity CA fee": "141199", - "swap CA custom curve + swap noop": "124402", - "swap CA fee on unspecified": "154572" + "addLiquidity CA fee": "173566", + "removeLiquidity CA fee": "143871", + "swap CA custom curve + swap noop": "127015", + "swap CA fee on unspecified": "157035" } \ No newline at end of file diff --git a/snapshots/ERC6909ClaimsTest.json b/snapshots/ERC6909ClaimsTest.json index bf1a063d7..47bc0fd81 100644 --- a/snapshots/ERC6909ClaimsTest.json +++ b/snapshots/ERC6909ClaimsTest.json @@ -1,9 +1,9 @@ { - "ERC6909Claims approve": "46323", - "ERC6909Claims burn": "29389", - "ERC6909Claims mint": "46603", - "ERC6909Claims transfer": "51756", - "ERC6909Claims transferFrom as operator": "54437", - "ERC6909Claims transferFrom with approval": "59939", - "ERC6909Claims transferFrom with infinite approval": "56770" + "ERC6909Claims approve": "46468", + "ERC6909Claims burn": "29404", + "ERC6909Claims mint": "46779", + "ERC6909Claims transfer": "52010", + "ERC6909Claims transferFrom as operator": "54615", + "ERC6909Claims transferFrom with approval": "60137", + "ERC6909Claims transferFrom with infinite approval": "56951" } \ No newline at end of file diff --git a/snapshots/ExtsloadTest.json b/snapshots/ExtsloadTest.json index 31ed61658..65a759893 100644 --- a/snapshots/ExtsloadTest.json +++ b/snapshots/ExtsloadTest.json @@ -1,3 +1,3 @@ { - "sparse external sload": "2164" + "sparse external sload": "2051" } \ No newline at end of file diff --git a/snapshots/ModifyLiquidityTest.json b/snapshots/ModifyLiquidityTest.json index 7744b9abe..e8bc25d86 100644 --- a/snapshots/ModifyLiquidityTest.json +++ b/snapshots/ModifyLiquidityTest.json @@ -1,4 +1,4 @@ { - "add liquidity to already existing position with salt": "144401", - "create new liquidity to a position with salt": "292593" + "add liquidity to already existing position with salt": "146620", + "create new liquidity to a position with salt": "294812" } \ No newline at end of file diff --git a/snapshots/PoolManagerTest.json b/snapshots/PoolManagerTest.json index d43defca1..945ede754 100644 --- a/snapshots/PoolManagerTest.json +++ b/snapshots/PoolManagerTest.json @@ -1,24 +1,24 @@ { - "addLiquidity with empty hook": "274012", - "addLiquidity with native token": "135001", - "donate gas with 1 token": "106214", - "donate gas with 2 tokens": "145510", - "erc20 collect protocol fees": "57500", + "addLiquidity with empty hook": "276767", + "addLiquidity with native token": "137147", + "donate gas with 1 token": "107761", + "donate gas with 2 tokens": "147192", + "erc20 collect protocol fees": "57572", "native collect protocol fees": "59643", "poolManager bytecode size": "24009", - "removeLiquidity with empty hook": "130613", - "removeLiquidity with native token": "112523", - "simple addLiquidity": "161276", - "simple addLiquidity second addition same range": "98731", - "simple removeLiquidity": "85099", - "simple removeLiquidity some liquidity remains": "92986", - "simple swap": "123144", - "simple swap with native": "108434", - "swap against liquidity": "116527", - "swap against liquidity with native token": "105569", - "swap burn 6909 for input": "129285", - "swap burn native 6909 for input": "118672", - "swap mint native output as 6909": "139620", - "swap mint output as 6909": "154985", - "swap with hooks": "132165" + "removeLiquidity with empty hook": "133378", + "removeLiquidity with native token": "114112", + "simple addLiquidity": "162479", + "simple addLiquidity second addition same range": "99934", + "simple removeLiquidity": "86182", + "simple removeLiquidity some liquidity remains": "94069", + "simple swap": "124307", + "simple swap with native": "109435", + "swap against liquidity": "118370", + "swap against liquidity with native token": "107379", + "swap burn 6909 for input": "130941", + "swap burn native 6909 for input": "120409", + "swap mint native output as 6909": "141471", + "swap mint output as 6909": "156740", + "swap with hooks": "134556" } \ No newline at end of file diff --git a/snapshots/ProtocolFeesTest.json b/snapshots/ProtocolFeesTest.json index 9b33cd5ff..841ba0713 100644 --- a/snapshots/ProtocolFeesTest.json +++ b/snapshots/ProtocolFeesTest.json @@ -1,3 +1,3 @@ { - "set protocol fee": "31730" + "set protocol fee": "32395" } \ No newline at end of file diff --git a/snapshots/SkipCallsTest.json b/snapshots/SkipCallsTest.json index 6aa00e361..b441bbf5d 100644 --- a/snapshots/SkipCallsTest.json +++ b/snapshots/SkipCallsTest.json @@ -1,3 +1,3 @@ { - "swap skips hook call if hook is caller": "206030" + "swap skips hook call if hook is caller": "209529" } \ No newline at end of file diff --git a/snapshots/SqrtPriceMathTest.json b/snapshots/SqrtPriceMathTest.json index 14f190d92..71da720f8 100644 --- a/snapshots/SqrtPriceMathTest.json +++ b/snapshots/SqrtPriceMathTest.json @@ -1,10 +1,10 @@ { - "getAmount0Delta_gasCostForAmount0WhereRoundUpIsFalse": "243", - "getAmount0Delta_gasCostForAmount0WhereRoundUpIsTrue": "360", - "getAmount1Delta_gasCostForAmount1WhereRoundUpIsFalse": "229", - "getAmount1Delta_gasCostForAmount1WhereRoundUpIsTrue": "264", - "getNextSqrtPriceFromInput_zeroForOneEqualsFalseGas": "316", - "getNextSqrtPriceFromInput_zeroForOneEqualsTrueGas": "539", - "getNextSqrtPriceFromOutput_zeroForOneEqualsFalseGas": "544", - "getNextSqrtPriceFromOutput_zeroForOneEqualsTrueGas": "214" + "getAmount0Delta_gasCostForAmount0WhereRoundUpIsFalse": "345", + "getAmount0Delta_gasCostForAmount0WhereRoundUpIsTrue": "481", + "getAmount1Delta_gasCostForAmount1WhereRoundUpIsFalse": "281", + "getAmount1Delta_gasCostForAmount1WhereRoundUpIsTrue": "282", + "getNextSqrtPriceFromInput_zeroForOneEqualsFalseGas": "411", + "getNextSqrtPriceFromInput_zeroForOneEqualsTrueGas": "602", + "getNextSqrtPriceFromOutput_zeroForOneEqualsFalseGas": "650", + "getNextSqrtPriceFromOutput_zeroForOneEqualsTrueGas": "285" } \ No newline at end of file diff --git a/snapshots/SwapMathTest.json b/snapshots/SwapMathTest.json index b2cd78767..e51699878 100644 --- a/snapshots/SwapMathTest.json +++ b/snapshots/SwapMathTest.json @@ -1,10 +1,10 @@ { - "SwapMath_oneForZero_exactInCapped": "1188", - "SwapMath_oneForZero_exactInPartial": "1274", - "SwapMath_oneForZero_exactOutCapped": "1001", - "SwapMath_oneForZero_exactOutPartial": "1565", - "SwapMath_zeroForOne_exactInCapped": "1126", - "SwapMath_zeroForOne_exactInPartial": "1439", - "SwapMath_zeroForOne_exactOutCapped": "919", - "SwapMath_zeroForOne_exactOutPartial": "1133" + "SwapMath_oneForZero_exactInCapped": "1499", + "SwapMath_oneForZero_exactInPartial": "1635", + "SwapMath_oneForZero_exactOutCapped": "1255", + "SwapMath_oneForZero_exactOutPartial": "1961", + "SwapMath_zeroForOne_exactInCapped": "1590", + "SwapMath_zeroForOne_exactInPartial": "1916", + "SwapMath_zeroForOne_exactOutCapped": "1346", + "SwapMath_zeroForOne_exactOutPartial": "1686" } \ No newline at end of file diff --git a/snapshots/SyncTest.json b/snapshots/SyncTest.json index 80aa773b0..0e4a2b46d 100644 --- a/snapshots/SyncTest.json +++ b/snapshots/SyncTest.json @@ -1,3 +1,3 @@ { - "getReserves": "3973" + "getReserves": "3891" } \ No newline at end of file diff --git a/snapshots/TestBitMath.json b/snapshots/TestBitMath.json index 3fe5a93b7..6b0e187ec 100644 --- a/snapshots/TestBitMath.json +++ b/snapshots/TestBitMath.json @@ -1,8 +1,8 @@ { - "BitMathLeastSignificantBitMaxUint128": "648", - "BitMathLeastSignificantBitMaxUint256": "648", - "BitMathLeastSignificantBitSmallNumber": "25", - "BitMathMostSignificantBitMaxUint128": "648", - "BitMathMostSignificantBitMaxUint256": "648", - "BitMathMostSignificantBitSmallNumber": "14" + "BitMathLeastSignificantBitMaxUint128": "718", + "BitMathLeastSignificantBitMaxUint256": "712", + "BitMathLeastSignificantBitSmallNumber": "99", + "BitMathMostSignificantBitMaxUint128": "757", + "BitMathMostSignificantBitMaxUint256": "751", + "BitMathMostSignificantBitSmallNumber": "138" } \ No newline at end of file diff --git a/snapshots/TestDelegateCall.json b/snapshots/TestDelegateCall.json index fb67febdc..f6d21ae4d 100644 --- a/snapshots/TestDelegateCall.json +++ b/snapshots/TestDelegateCall.json @@ -1,3 +1,3 @@ { - "NoDelegateCall": "51" + "NoDelegateCall": "41" } \ No newline at end of file diff --git a/snapshots/TestDynamicFees.json b/snapshots/TestDynamicFees.json index b25bd6b18..eb799fff4 100644 --- a/snapshots/TestDynamicFees.json +++ b/snapshots/TestDynamicFees.json @@ -1,4 +1,4 @@ { - "swap with dynamic fee": "139153", - "update dynamic fee in before swap": "147743" + "swap with dynamic fee": "140996", + "update dynamic fee in before swap": "150033" } \ No newline at end of file diff --git a/snapshots/TestDynamicReturnFees.json b/snapshots/TestDynamicReturnFees.json index d2635299d..b788c0cf3 100644 --- a/snapshots/TestDynamicReturnFees.json +++ b/snapshots/TestDynamicReturnFees.json @@ -1,3 +1,3 @@ { - "swap with return dynamic fee": "145475" + "swap with return dynamic fee": "147636" } \ No newline at end of file diff --git a/snapshots/TickBitmapTest.json b/snapshots/TickBitmapTest.json index 58ea2043c..8dede0dd7 100644 --- a/snapshots/TickBitmapTest.json +++ b/snapshots/TickBitmapTest.json @@ -1,11 +1,11 @@ { - "flipTick_flippingATickThatResultsInDeletingAWord": "5109", - "flipTick_flippingFirstTickInWordToInitialized": "22209", - "flipTick_flippingSecondTickInWordToInitialized": "5178", - "nextInitializedTickWithinOneWord_lteFalse_forEntireWord": "2263", - "nextInitializedTickWithinOneWord_lteFalse_justBelowBoundary": "2252", - "nextInitializedTickWithinOneWord_lteFalse_onBoundary": "2281", - "nextInitializedTickWithinOneWord_lteTrue_forEntireWord": "2258", - "nextInitializedTickWithinOneWord_lteTrue_justBelowBoundary": "2242", - "nextInitializedTickWithinOneWord_lteTrue_onBoundary_gas": "2287" + "flipTick_flippingATickThatResultsInDeletingAWord": "5168", + "flipTick_flippingFirstTickInWordToInitialized": "22268", + "flipTick_flippingSecondTickInWordToInitialized": "5280", + "nextInitializedTickWithinOneWord_lteFalse_forEntireWord": "2436", + "nextInitializedTickWithinOneWord_lteFalse_justBelowBoundary": "2436", + "nextInitializedTickWithinOneWord_lteFalse_onBoundary": "2436", + "nextInitializedTickWithinOneWord_lteTrue_forEntireWord": "2441", + "nextInitializedTickWithinOneWord_lteTrue_justBelowBoundary": "2632", + "nextInitializedTickWithinOneWord_lteTrue_onBoundary_gas": "2441" } \ No newline at end of file diff --git a/snapshots/TickMathTestTest.json b/snapshots/TickMathTestTest.json index 40e17de11..54c43f38e 100644 --- a/snapshots/TickMathTestTest.json +++ b/snapshots/TickMathTestTest.json @@ -1,4 +1,4 @@ { - "TickMathGetSqrtPriceAtTick": "72349", - "TickMathGetTickAtSqrtPrice": "195022" + "TickMathGetSqrtPriceAtTick": "74639", + "TickMathGetTickAtSqrtPrice": "211308" } \ No newline at end of file diff --git a/snapshots/TickTest.json b/snapshots/TickTest.json index ec655cb3b..bfdc36616 100644 --- a/snapshots/TickTest.json +++ b/snapshots/TickTest.json @@ -1,5 +1,5 @@ { - "tickSpacingToMaxLiquidityPerTick_gasCost60TickSpacing": "25", - "tickSpacingToMaxLiquidityPerTick_gasCostMaxTickSpacing": "25", - "tickSpacingToMaxLiquidityPerTick_gasCostMinTickSpacing": "25" + "tickSpacingToMaxLiquidityPerTick_gasCost60TickSpacing": "65", + "tickSpacingToMaxLiquidityPerTick_gasCostMaxTickSpacing": "73", + "tickSpacingToMaxLiquidityPerTick_gasCostMinTickSpacing": "65" } \ No newline at end of file diff --git a/test/DynamicReturnFees.t.sol b/test/DynamicReturnFees.t.sol index 0f157fbfa..8a692fc91 100644 --- a/test/DynamicReturnFees.t.sol +++ b/test/DynamicReturnFees.t.sol @@ -10,7 +10,6 @@ import {IPoolManager} from "../src/interfaces/IPoolManager.sol"; import {IProtocolFees} from "../src/interfaces/IProtocolFees.sol"; import {IHooks} from "../src/interfaces/IHooks.sol"; import {PoolKey} from "../src/types/PoolKey.sol"; -import {PoolManager} from "../src/PoolManager.sol"; import {PoolSwapTest} from "../src/test/PoolSwapTest.sol"; import {Deployers} from "./utils/Deployers.sol"; import {DynamicReturnFeeTestHook} from "../src/test/DynamicReturnFeeTestHook.sol"; diff --git a/test/NoDelegateCall.t.sol b/test/NoDelegateCall.t.sol index 612c9acb8..7f8379a10 100644 --- a/test/NoDelegateCall.t.sol +++ b/test/NoDelegateCall.t.sol @@ -6,15 +6,15 @@ import {IPoolManager} from "../src/interfaces/IPoolManager.sol"; import {PoolSwapTest} from "../src/test/PoolSwapTest.sol"; import {ProxyPoolManager} from "../src/test/ProxyPoolManager.sol"; import {NoDelegateCallTest} from "../src/test/NoDelegateCallTest.sol"; -import {PoolManager} from "../src/PoolManager.sol"; import {NoDelegateCall} from "../src/NoDelegateCall.sol"; import {Deployers} from "./utils/Deployers.sol"; contract TestDelegateCall is Test, Deployers { // override to use ProxyPoolManager - function deployFreshManager() internal virtual override { - IPoolManager delegateManager = new PoolManager(address(this)); + function deployFreshManager() internal virtual override returns (IPoolManager manager_) { + IPoolManager delegateManager = super.deployFreshManager(); manager = new ProxyPoolManager(address(delegateManager)); + return manager; } NoDelegateCallTest noDelegateCallTest; diff --git a/test/PoolManager.t.sol b/test/PoolManager.t.sol index e469b25be..d1c2ff156 100644 --- a/test/PoolManager.t.sol +++ b/test/PoolManager.t.sol @@ -6,7 +6,6 @@ import {IHooks} from "../src/interfaces/IHooks.sol"; import {Hooks} from "../src/libraries/Hooks.sol"; import {IPoolManager} from "../src/interfaces/IPoolManager.sol"; import {IProtocolFees} from "../src/interfaces/IProtocolFees.sol"; -import {PoolManager} from "../src/PoolManager.sol"; import {TickMath} from "../src/libraries/TickMath.sol"; import {Pool} from "../src/libraries/Pool.sol"; import {Deployers} from "./utils/Deployers.sol"; diff --git a/test/PoolManagerInitialize.t.sol b/test/PoolManagerInitialize.t.sol index 8ec018756..f48da5d68 100644 --- a/test/PoolManagerInitialize.t.sol +++ b/test/PoolManagerInitialize.t.sol @@ -6,7 +6,6 @@ import {IHooks} from "../src/interfaces/IHooks.sol"; import {Hooks} from "../src/libraries/Hooks.sol"; import {IPoolManager} from "../src/interfaces/IPoolManager.sol"; import {IProtocolFees} from "../src/interfaces/IProtocolFees.sol"; -import {PoolManager} from "../src/PoolManager.sol"; import {TickMath} from "../src/libraries/TickMath.sol"; import {Pool} from "../src/libraries/Pool.sol"; import {Deployers} from "./utils/Deployers.sol"; diff --git a/test/SkipCallsTestHook.t.sol b/test/SkipCallsTestHook.t.sol index 9da67da29..ee8d51ea4 100644 --- a/test/SkipCallsTestHook.t.sol +++ b/test/SkipCallsTestHook.t.sol @@ -9,7 +9,6 @@ import {IPoolManager} from "../src/interfaces/IPoolManager.sol"; import {IProtocolFees} from "../src/interfaces/IProtocolFees.sol"; import {IHooks} from "../src/interfaces/IHooks.sol"; import {PoolKey} from "../src/types/PoolKey.sol"; -import {PoolManager} from "../src/PoolManager.sol"; import {PoolSwapTest} from "../src/test/PoolSwapTest.sol"; import {Deployers} from "./utils/Deployers.sol"; import {Currency} from "../src/types/Currency.sol"; diff --git a/test/libraries/Hooks.t.sol b/test/libraries/Hooks.t.sol index 6d7da20a1..964970af9 100644 --- a/test/libraries/Hooks.t.sol +++ b/test/libraries/Hooks.t.sol @@ -10,7 +10,6 @@ import {IPoolManager} from "../../src/interfaces/IPoolManager.sol"; import {MockERC20} from "solmate/src/test/utils/mocks/MockERC20.sol"; import {IHooks} from "../../src/interfaces/IHooks.sol"; import {Currency} from "../../src/types/Currency.sol"; -import {PoolManager} from "../../src/PoolManager.sol"; import {PoolSwapTest} from "../../src/test/PoolSwapTest.sol"; import {PoolDonateTest} from "../../src/test/PoolDonateTest.sol"; import {Deployers} from "test/utils/Deployers.sol"; diff --git a/test/libraries/Pool.t.sol b/test/libraries/Pool.t.sol index e93e9f1df..7168e0a3c 100644 --- a/test/libraries/Pool.t.sol +++ b/test/libraries/Pool.t.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.20; import {Test} from "forge-std/Test.sol"; import {Vm} from "forge-std/Vm.sol"; import {Pool} from "../../src/libraries/Pool.sol"; -import {PoolManager} from "../../src/PoolManager.sol"; import {Position} from "../../src/libraries/Position.sol"; import {TickMath} from "../../src/libraries/TickMath.sol"; import {TickBitmap} from "../../src/libraries/TickBitmap.sol"; diff --git a/test/utils/Deployers.sol b/test/utils/Deployers.sol index 88559148b..261b27708 100644 --- a/test/utils/Deployers.sol +++ b/test/utils/Deployers.sol @@ -7,7 +7,6 @@ import {Hooks} from "../../src/libraries/Hooks.sol"; import {Currency, CurrencyLibrary} from "../../src/types/Currency.sol"; import {IHooks} from "../../src/interfaces/IHooks.sol"; import {IPoolManager} from "../../src/interfaces/IPoolManager.sol"; -import {PoolManager} from "../../src/PoolManager.sol"; import {PoolId} from "../../src/types/PoolId.sol"; import {LPFeeLibrary} from "../../src/libraries/LPFeeLibrary.sol"; import {PoolKey} from "../../src/types/PoolKey.sol"; @@ -83,8 +82,13 @@ contract Deployers is Test { } } - function deployFreshManager() internal virtual { - manager = new PoolManager(address(this)); + function deployFreshManager() internal virtual returns (IPoolManager manager_) { + bytes memory bytecode = + abi.encodePacked(vm.getCode("out/PoolManager.sol/PoolManager.default.json"), abi.encode(address(this))); + assembly { + manager_ := create(0, add(bytecode, 0x20), mload(bytecode)) + } + manager = manager_; } function deployFreshManagerAndRouters() internal { diff --git a/test/utils/SwapHelper.t.sol b/test/utils/SwapHelper.t.sol index a6dd00533..7f54fb6de 100644 --- a/test/utils/SwapHelper.t.sol +++ b/test/utils/SwapHelper.t.sol @@ -9,7 +9,6 @@ import {IPoolManager} from "../../src/interfaces/IPoolManager.sol"; import {MockERC20} from "solmate/src/test/utils/mocks/MockERC20.sol"; import {IHooks} from "../../src/interfaces/IHooks.sol"; import {Currency} from "../../src/types/Currency.sol"; -import {PoolManager} from "../../src/PoolManager.sol"; import {PoolSwapTest} from "../../src/test/PoolSwapTest.sol"; import {PoolDonateTest} from "../../src/test/PoolDonateTest.sol"; import {Deployers} from "./Deployers.sol";