harb/onchain/src
openhands 534382f785 fix: CREATE2 self-destruct bypass in onchain/src/LiquidityManager.sol (#921)
The previous guard blocked setFeeDestination when feeDestination.code.length > 0
but did not persist feeDestinationLocked — a revert undoes all state changes. An
attacker could CREATE2-deploy bytecode to the EOA fee destination, triggering the
block, then SELFDESTRUCT to clear the code, then call setFeeDestination again
successfully (lock was never committed).

Fix: detect bytecode at the current feeDestination first; if found, set
feeDestinationLocked = true and RETURN (not revert) so the storage write is
committed. A subsequent SELFDESTRUCT cannot undo a committed storage slot.
Updated NatSpec documents both the protection and the remaining limitation
(atomic CREATE2+SELFDESTRUCT in a single tx cannot be detected).

Added testSetFeeDestination_CREATE2BytecodeDetection_Locks covering:
set EOA → vm.etch (simulate CREATE2 deploy) → verify lock committed → vm.etch
empty (simulate selfdestruct) → verify setter still blocked.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 11:58:28 +00:00
..
abstracts fix: Unclamped anchorWidth can overflow tick range — no upper-bound guard after MAX_ANCHOR_WIDTH removal (#783) (#817) 2026-03-15 21:34:33 +00:00
helpers Add Solidity linting with solhint, Foundry formatter, and pre-commit hooks (#51) 2025-10-04 15:17:09 +02:00
interfaces beautified 2025-07-08 10:33:10 +02:00
libraries feat: OptimizerV3 with direct 2D staking-to-LP parameter mapping 2026-02-13 18:21:18 +00:00
IOptimizer.sol fix: fix: remove MAX_ANCHOR_WIDTH clamp in ThreePositionStrategy (#783) 2026-03-14 23:21:30 +00:00
Kraiken.sol fix: add symmetric InvalidAddress guard to setLiquidityManager (#935) 2026-03-18 09:45:43 +00:00
LiquidityManager.sol fix: CREATE2 self-destruct bypass in onchain/src/LiquidityManager.sol (#921) 2026-03-18 11:58:28 +00:00
Optimizer.sol fix: update stale comments after CALCULATE_PARAMS_GAS_LIMIT bump to 500k 2026-03-15 00:28:12 +00:00
OptimizerV3.sol fix: OptimizerV3 / OptimizerV3Push3 not explicitly typed against IOptimizer (#661) 2026-03-14 05:08:32 +00:00
OptimizerV3Push3.sol fix: calculateParams in OptimizerV3Push3 has no NatSpec after this PR (#735) 2026-03-14 06:20:37 +00:00
Stake.sol fix: Stake.sol: exitPosition guard order (owner check before existence) (#307) 2026-02-27 06:33:32 +00:00
VWAPTracker.sol fix: fix: Restore proper VWAP — gas-efficient volume-weighted pricing (revert TWAP) (#603) 2026-03-12 08:50:07 +00:00