Skip to content

Commit

Permalink
add compilation restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
gretzke committed Nov 22, 2024
1 parent b619b67 commit 85f1e9e
Show file tree
Hide file tree
Showing 27 changed files with 95 additions and 90 deletions.
8 changes: 8 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions snapshots/CustomAccountingTest.json
Original file line number Diff line number Diff line change
@@ -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"
}
14 changes: 7 additions & 7 deletions snapshots/ERC6909ClaimsTest.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion snapshots/ExtsloadTest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"sparse external sload": "2164"
"sparse external sload": "2051"
}
4 changes: 2 additions & 2 deletions snapshots/ModifyLiquidityTest.json
Original file line number Diff line number Diff line change
@@ -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"
}
40 changes: 20 additions & 20 deletions snapshots/PoolManagerTest.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion snapshots/ProtocolFeesTest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"set protocol fee": "31730"
"set protocol fee": "32395"
}
2 changes: 1 addition & 1 deletion snapshots/SkipCallsTest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"swap skips hook call if hook is caller": "206030"
"swap skips hook call if hook is caller": "209529"
}
16 changes: 8 additions & 8 deletions snapshots/SqrtPriceMathTest.json
Original file line number Diff line number Diff line change
@@ -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"
}
16 changes: 8 additions & 8 deletions snapshots/SwapMathTest.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion snapshots/SyncTest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"getReserves": "3973"
"getReserves": "3891"
}
12 changes: 6 additions & 6 deletions snapshots/TestBitMath.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion snapshots/TestDelegateCall.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"NoDelegateCall": "51"
"NoDelegateCall": "41"
}
4 changes: 2 additions & 2 deletions snapshots/TestDynamicFees.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion snapshots/TestDynamicReturnFees.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"swap with return dynamic fee": "145475"
"swap with return dynamic fee": "147636"
}
18 changes: 9 additions & 9 deletions snapshots/TickBitmapTest.json
Original file line number Diff line number Diff line change
@@ -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"
}
4 changes: 2 additions & 2 deletions snapshots/TickMathTestTest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"TickMathGetSqrtPriceAtTick": "72349",
"TickMathGetTickAtSqrtPrice": "195022"
"TickMathGetSqrtPriceAtTick": "74639",
"TickMathGetTickAtSqrtPrice": "211308"
}
6 changes: 3 additions & 3 deletions snapshots/TickTest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"tickSpacingToMaxLiquidityPerTick_gasCost60TickSpacing": "25",
"tickSpacingToMaxLiquidityPerTick_gasCostMaxTickSpacing": "25",
"tickSpacingToMaxLiquidityPerTick_gasCostMinTickSpacing": "25"
"tickSpacingToMaxLiquidityPerTick_gasCost60TickSpacing": "65",
"tickSpacingToMaxLiquidityPerTick_gasCostMaxTickSpacing": "73",
"tickSpacingToMaxLiquidityPerTick_gasCostMinTickSpacing": "65"
}
1 change: 0 additions & 1 deletion test/DynamicReturnFees.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
6 changes: 3 additions & 3 deletions test/NoDelegateCall.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion test/PoolManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 0 additions & 1 deletion test/PoolManagerInitialize.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 0 additions & 1 deletion test/SkipCallsTestHook.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 0 additions & 1 deletion test/libraries/Hooks.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 0 additions & 1 deletion test/libraries/Pool.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
10 changes: 7 additions & 3 deletions test/utils/Deployers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion test/utils/SwapHelper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 85f1e9e

Please sign in to comment.