From 389b3cbe45a0efab08c2774f2880b1f92c0406c3 Mon Sep 17 00:00:00 2001 From: ChefMist <133624774+ChefMist@users.noreply.github.com> Date: Sun, 26 Jan 2025 11:59:36 +0800 Subject: [PATCH] feat: increase optimizer runs --- foundry.toml | 10 +++++++++- snapshots/BaseActionsRouterTest.json | 2 +- snapshots/BinMigratorFromPancakeswapV2Test.json | 6 +++--- snapshots/BinMigratorFromPancakeswapV3Test.json | 8 ++++---- snapshots/BinMigratorFromUniswapV2Test.json | 6 +++--- snapshots/BinMigratorFromUniswapV3Test.json | 8 ++++---- snapshots/BinPositionManagerTest.json | 2 +- .../BinPositionManager_ModifyLiquidityTest.json | 10 +++++----- snapshots/BinPositionManager_NativeTokenTest.json | 6 +++--- snapshots/BinQuoterTest.json | 2 +- snapshots/BinSwapRouterTest.json | 14 +++++++------- snapshots/CLPositionDescriptorOffChainTest.json | 2 +- snapshots/CLQuoterTest.json | 2 +- snapshots/CLSwapRouterTest.json | 8 ++++---- test/MixedQuoter.t.sol | 2 +- 15 files changed, 48 insertions(+), 40 deletions(-) diff --git a/foundry.toml b/foundry.toml index 9fb6815..8434562 100644 --- a/foundry.toml +++ b/foundry.toml @@ -2,7 +2,7 @@ src = 'src' out = 'foundry-out' solc_version = '0.8.26' -optimizer_runs = 9000 +optimizer_runs = 1_000_000 via_ir = true ffi = true gas_limit = "3000000000" @@ -15,6 +15,14 @@ fs_permissions = [ evm_version = 'cancun' bytecode_hash = "none" +additional_compiler_profiles = [ + { name = "clPosm", optimizer_runs = 9000 } +] + +compilation_restrictions = [ + { paths = "src/pool-cl/CLPositionManager.sol", optimizer_runs = 9000 } +] + [fuzz] runs = 5 # change this for higher number of fuzz runs locally diff --git a/snapshots/BaseActionsRouterTest.json b/snapshots/BaseActionsRouterTest.json index c046d58..54060ad 100644 --- a/snapshots/BaseActionsRouterTest.json +++ b/snapshots/BaseActionsRouterTest.json @@ -1,3 +1,3 @@ { - "mock10commands": "82833" + "mock10commands": "82785" } \ No newline at end of file diff --git a/snapshots/BinMigratorFromPancakeswapV2Test.json b/snapshots/BinMigratorFromPancakeswapV2Test.json index 13f6857..6486edf 100644 --- a/snapshots/BinMigratorFromPancakeswapV2Test.json +++ b/snapshots/BinMigratorFromPancakeswapV2Test.json @@ -1,5 +1,5 @@ { - "testMigrateFromV2IncludingInit": "1180066", - "testMigrateFromV2WithoutInit": "1049481", - "testMigrateFromV2WithoutNativeToken": "1090203" + "testMigrateFromV2IncludingInit": "1176442", + "testMigrateFromV2WithoutInit": "1046490", + "testMigrateFromV2WithoutNativeToken": "1087310" } \ No newline at end of file diff --git a/snapshots/BinMigratorFromPancakeswapV3Test.json b/snapshots/BinMigratorFromPancakeswapV3Test.json index 9e56e53..1565d59 100644 --- a/snapshots/BinMigratorFromPancakeswapV3Test.json +++ b/snapshots/BinMigratorFromPancakeswapV3Test.json @@ -1,6 +1,6 @@ { - "BinMigratorBytecode size": "12601", - "testMigrateFromV3IncludingInit": "1252393", - "testMigrateFromV3WithoutInit": "1121789", - "testMigrateFromV3WithoutNativeToken": "1156506" + "BinMigratorBytecode size": "15187", + "testMigrateFromV3IncludingInit": "1248658", + "testMigrateFromV3WithoutInit": "1118687", + "testMigrateFromV3WithoutNativeToken": "1153511" } \ No newline at end of file diff --git a/snapshots/BinMigratorFromUniswapV2Test.json b/snapshots/BinMigratorFromUniswapV2Test.json index 13f6857..6486edf 100644 --- a/snapshots/BinMigratorFromUniswapV2Test.json +++ b/snapshots/BinMigratorFromUniswapV2Test.json @@ -1,5 +1,5 @@ { - "testMigrateFromV2IncludingInit": "1180066", - "testMigrateFromV2WithoutInit": "1049481", - "testMigrateFromV2WithoutNativeToken": "1090203" + "testMigrateFromV2IncludingInit": "1176442", + "testMigrateFromV2WithoutInit": "1046490", + "testMigrateFromV2WithoutNativeToken": "1087310" } \ No newline at end of file diff --git a/snapshots/BinMigratorFromUniswapV3Test.json b/snapshots/BinMigratorFromUniswapV3Test.json index 82f6fdd..51ba712 100644 --- a/snapshots/BinMigratorFromUniswapV3Test.json +++ b/snapshots/BinMigratorFromUniswapV3Test.json @@ -1,6 +1,6 @@ { - "BinMigratorBytecode size": "12601", - "testMigrateFromV3IncludingInit": "1250375", - "testMigrateFromV3WithoutInit": "1119771", - "testMigrateFromV3WithoutNativeToken": "1154488" + "BinMigratorBytecode size": "15187", + "testMigrateFromV3IncludingInit": "1246640", + "testMigrateFromV3WithoutInit": "1116669", + "testMigrateFromV3WithoutNativeToken": "1151493" } \ No newline at end of file diff --git a/snapshots/BinPositionManagerTest.json b/snapshots/BinPositionManagerTest.json index a4a0e31..79535f2 100644 --- a/snapshots/BinPositionManagerTest.json +++ b/snapshots/BinPositionManagerTest.json @@ -1,3 +1,3 @@ { - "BinPositionManagerBytecode size": "15154" + "BinPositionManagerBytecode size": "17435" } \ No newline at end of file diff --git a/snapshots/BinPositionManager_ModifyLiquidityTest.json b/snapshots/BinPositionManager_ModifyLiquidityTest.json index 3359887..bb871f1 100644 --- a/snapshots/BinPositionManager_ModifyLiquidityTest.json +++ b/snapshots/BinPositionManager_ModifyLiquidityTest.json @@ -1,7 +1,7 @@ { - "test_addLiquidity_OutsideActiveId": "294827", - "test_addLiquidity_SingleBin": "533778", - "test_addLiquidity_ThreeBins": "908043", - "test_decreaseLiquidity_threeBins": "186051", - "test_decreaseLiquidity_threeBins_half": "205238" + "test_addLiquidity_OutsideActiveId": "292694", + "test_addLiquidity_SingleBin": "532073", + "test_addLiquidity_ThreeBins": "905930", + "test_decreaseLiquidity_threeBins": "184859", + "test_decreaseLiquidity_threeBins_half": "203748" } \ No newline at end of file diff --git a/snapshots/BinPositionManager_NativeTokenTest.json b/snapshots/BinPositionManager_NativeTokenTest.json index dcc9f55..549c5bc 100644 --- a/snapshots/BinPositionManager_NativeTokenTest.json +++ b/snapshots/BinPositionManager_NativeTokenTest.json @@ -1,5 +1,5 @@ { - "test_addLiquidity": "849375", - "test_addLiquidity_excessEth": "851136", - "test_decreaseLiquidity": "192695" + "test_addLiquidity": "847340", + "test_addLiquidity_excessEth": "849077", + "test_decreaseLiquidity": "191515" } \ No newline at end of file diff --git a/snapshots/BinQuoterTest.json b/snapshots/BinQuoterTest.json index 91a6ce2..95cd4f1 100644 --- a/snapshots/BinQuoterTest.json +++ b/snapshots/BinQuoterTest.json @@ -1,3 +1,3 @@ { - "BinQuoterBytecode size": "6299" + "BinQuoterBytecode size": "6839" } \ No newline at end of file diff --git a/snapshots/BinSwapRouterTest.json b/snapshots/BinSwapRouterTest.json index 9faf988..d38d3fb 100644 --- a/snapshots/BinSwapRouterTest.json +++ b/snapshots/BinSwapRouterTest.json @@ -1,9 +1,9 @@ { - "testExactInputSingle_DifferentRecipient": "137214", - "testExactInputSingle_EthPool_SwapEthForToken": "125543", - "testExactInputSingle_EthPool_SwapTokenForEth": "111288", - "testExactInput_MultiHopDifferentRecipient": "168754", - "testExactOutputSingle_DifferentRecipient": "141480", - "testExactOutput_MultiHopDifferentRecipient": "172390", - "testExactOutput_SingleHop": "143161" + "testExactInputSingle_DifferentRecipient": "136133", + "testExactInputSingle_EthPool_SwapEthForToken": "124501", + "testExactInputSingle_EthPool_SwapTokenForEth": "110210", + "testExactInput_MultiHopDifferentRecipient": "166964", + "testExactOutputSingle_DifferentRecipient": "140509", + "testExactOutput_MultiHopDifferentRecipient": "170820", + "testExactOutput_SingleHop": "142184" } \ No newline at end of file diff --git a/snapshots/CLPositionDescriptorOffChainTest.json b/snapshots/CLPositionDescriptorOffChainTest.json index 7104df1..a63a1f0 100644 --- a/snapshots/CLPositionDescriptorOffChainTest.json +++ b/snapshots/CLPositionDescriptorOffChainTest.json @@ -1,3 +1,3 @@ { - "CLPositionDescriptorOffChain size": "2568" + "CLPositionDescriptorOffChain size": "2958" } \ No newline at end of file diff --git a/snapshots/CLQuoterTest.json b/snapshots/CLQuoterTest.json index d67998b..046e12b 100644 --- a/snapshots/CLQuoterTest.json +++ b/snapshots/CLQuoterTest.json @@ -1,3 +1,3 @@ { - "CLQuoterBytecode size": "6458" + "CLQuoterBytecode size": "6998" } \ No newline at end of file diff --git a/snapshots/CLSwapRouterTest.json b/snapshots/CLSwapRouterTest.json index 0cab303..a3658ce 100644 --- a/snapshots/CLSwapRouterTest.json +++ b/snapshots/CLSwapRouterTest.json @@ -1,6 +1,6 @@ { - "testExactInputSingle_gas": "169788", - "testExactInput_gas": "234192", - "testExactOutputSingle_gas": "169491", - "testExactOutput_gas": "233092" + "testExactInputSingle_gas": "168817", + "testExactInput_gas": "232455", + "testExactOutputSingle_gas": "168510", + "testExactOutput_gas": "231337" } \ No newline at end of file diff --git a/test/MixedQuoter.t.sol b/test/MixedQuoter.t.sol index c9bc88d..9ff8559 100644 --- a/test/MixedQuoter.t.sol +++ b/test/MixedQuoter.t.sol @@ -1514,7 +1514,7 @@ contract MixedQuoterTest is (uint256 amountOut, uint256 gasEstimate) = mixedQuoter.quoteMixedExactInput(paths, actions, params, 1 ether); assertEq(amountOut, 901152761185198407); - assertGt(gasEstimate, 190000); + assertGt(gasEstimate, 180000); assertLt(gasEstimate, 200000); }