From c0fa8c064f98c611d0e19ea1acba4d96d77d3a2c Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 16 Mar 2026 08:53:33 +0000 Subject: [PATCH 1/2] fix: evolution.patch references removed LiquidityManager constant (pre-existing structural debt) (#842) Regenerate evolution.patch from the current ThreePositionStrategy.sol. The old patch had a corrupt hunk header (@@ -33,7 +33,7 @@ claiming 7 lines but only supplying 4) and placeholder index hashes (0000000..0000000), causing `git apply` to reject it with "corrupt patch". MAX_ANCHOR_WIDTH still exists in the file at value 1233; the patch correctly overrides it to type(uint24).max for unbounded evolution runs. Co-Authored-By: Claude Sonnet 4.6 --- tools/push3-evolution/evolution.patch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/push3-evolution/evolution.patch b/tools/push3-evolution/evolution.patch index b08d98e..f726696 100644 --- a/tools/push3-evolution/evolution.patch +++ b/tools/push3-evolution/evolution.patch @@ -1,10 +1,13 @@ diff --git a/onchain/src/abstracts/ThreePositionStrategy.sol b/onchain/src/abstracts/ThreePositionStrategy.sol -index 0000000..0000000 100644 +index d3e2c0b..072b6e3 100644 --- a/onchain/src/abstracts/ThreePositionStrategy.sol +++ b/onchain/src/abstracts/ThreePositionStrategy.sol -@@ -33,7 +33,7 @@ +@@ -33,7 +33,7 @@ abstract contract ThreePositionStrategy is UniswapMath, VWAPTracker { /// @notice Maximum safe anchorWidth: ensures 34 * MAX_ANCHOR_WIDTH * TICK_SPACING / 100 fits in int24 /// @dev With TICK_SPACING=200: 34 * 1233 * 200 = 8,384,400 ≤ int24 max (8,388,607). /// anchorWidth=1234 produces 8,391,200 which overflows int24 and reverts in Solidity 0.8. - uint24 internal constant MAX_ANCHOR_WIDTH = 1233; + uint24 internal constant MAX_ANCHOR_WIDTH = type(uint24).max; + + /// @notice The three liquidity position types + enum Stage { From 777bec85635a1add53157ad3a0a3c68342594593 Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 16 Mar 2026 09:20:41 +0000 Subject: [PATCH 2/2] fix: evolution.patch references removed LiquidityManager constant (pre-existing structural debt) (#842) Extend the patch to also replace the NatSpec comments above MAX_ANCHOR_WIDTH, which became misleading after switching to type(uint24).max. The old comments claimed overflow-safety ("fits in int24"); the new comments document that the production cap is 1233, that values above 123358 overflow int24 and revert, and that this is tolerable in the evolution context where reverts score zero fitness. The patch now correctly updates both the constant and its documentation. Co-Authored-By: Claude Sonnet 4.6 --- tools/push3-evolution/evolution.patch | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/push3-evolution/evolution.patch b/tools/push3-evolution/evolution.patch index f726696..bdb1232 100644 --- a/tools/push3-evolution/evolution.patch +++ b/tools/push3-evolution/evolution.patch @@ -1,12 +1,18 @@ diff --git a/onchain/src/abstracts/ThreePositionStrategy.sol b/onchain/src/abstracts/ThreePositionStrategy.sol -index d3e2c0b..072b6e3 100644 +index d3e2c0b..c8b011e 100644 --- a/onchain/src/abstracts/ThreePositionStrategy.sol +++ b/onchain/src/abstracts/ThreePositionStrategy.sol -@@ -33,7 +33,7 @@ abstract contract ThreePositionStrategy is UniswapMath, VWAPTracker { - /// @notice Maximum safe anchorWidth: ensures 34 * MAX_ANCHOR_WIDTH * TICK_SPACING / 100 fits in int24 - /// @dev With TICK_SPACING=200: 34 * 1233 * 200 = 8,384,400 ≤ int24 max (8,388,607). - /// anchorWidth=1234 produces 8,391,200 which overflows int24 and reverts in Solidity 0.8. +@@ -30,10 +30,10 @@ abstract contract ThreePositionStrategy is UniswapMath, VWAPTracker { + int24 internal constant DISCOVERY_SPACING = 11_000; + /// @notice Minimum discovery depth multiplier + uint128 internal constant MIN_DISCOVERY_DEPTH = 200; +- /// @notice Maximum safe anchorWidth: ensures 34 * MAX_ANCHOR_WIDTH * TICK_SPACING / 100 fits in int24 +- /// @dev With TICK_SPACING=200: 34 * 1233 * 200 = 8,384,400 ≤ int24 max (8,388,607). +- /// anchorWidth=1234 produces 8,391,200 which overflows int24 and reverts in Solidity 0.8. - uint24 internal constant MAX_ANCHOR_WIDTH = 1233; ++ /// @notice EVOLUTION OVERRIDE: unbounded anchor-width exploration (see tools/push3-evolution/evolution.patch). ++ /// @dev Production cap is 1233; values above 123358 overflow int24 anchorSpacing (200 + 68 * anchorWidth) ++ /// and revert — tolerable in evolution context where reverts are scored as zero fitness. + uint24 internal constant MAX_ANCHOR_WIDTH = type(uint24).max; /// @notice The three liquidity position types