harb/onchain/test
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: address review findings for anchorWidth guard (#817) 2026-03-15 22:04:13 +00:00
helpers fix: address AI review findings for #706 recenterAccess removal 2026-03-14 09:15:48 +00:00
libraries Add Solidity linting with solhint, Foundry formatter, and pre-commit hooks (#51) 2025-10-04 15:17:09 +02:00
mocks fix: feat: Push3 input redesign — normalized indicators instead of raw protocol values (#635) (#649) 2026-03-13 07:53:46 +01:00
EthScarcityAbundance.t.sol fix: address AI review findings for #706 recenterAccess removal 2026-03-14 09:15:48 +00:00
FitnessEvaluator.t.sol fix: fix: FitnessEvaluator.t.sol broken on Base mainnet fork (#780) 2026-03-15 02:13:04 +00:00
FuzzingAnalyzerBugs.t.sol fix: address AI review findings for #706 recenterAccess removal 2026-03-14 09:15:48 +00:00
Kraiken.t.sol fix: add symmetric InvalidAddress guard to setLiquidityManager (#935) 2026-03-18 09:45:43 +00:00
LiquidityManager.t.sol fix: CREATE2 self-destruct bypass in onchain/src/LiquidityManager.sol (#921) 2026-03-18 11:58:28 +00:00
Optimizer.t.sol fix: feat: Push3 input redesign — normalized indicators instead of raw protocol values (#635) (#649) 2026-03-13 07:53:46 +01:00
OptimizerV3Push3.t.sol fix: PR #551 review findings - OptimizerV3Push3.sol + Optimizer.sol 2026-03-10 23:13:57 +00:00
ReplayProfitableScenario.t.sol fix: address AI review findings for #706 recenterAccess removal 2026-03-14 09:15:48 +00:00
Stake.t.sol fix: Test coverage: Stake.sol to 100% (#284) 2026-02-26 03:59:20 +00:00
SupplyCorruption.t.sol fix: address AI review findings for #706 recenterAccess removal 2026-03-14 09:15:48 +00:00
VWAPFloorProtection.t.sol fix: address AI review findings for #706 recenterAccess removal 2026-03-14 09:15:48 +00:00
VWAPTracker.t.sol fix: Backtesting #5: Position tracking + P&L metrics (#319) 2026-02-27 11:23:18 +00:00