Fix liquidity migration bug #535
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
FIXED: Resolves critical hook migration bug that caused
CannotUpdateEmptyPosition()errors when migrating from hooks that store two positions in the same ticks.Bug Description
Location:
V4Liquidity.burnPositions()functionError:
CannotUpdateEmptyPosition()Cause: Function attempted to modify positions with
liquidityDelta: 0on already-empty positionsRoot Cause Analysis
The migration logic tried to burn positions that had zero liquidity, causing Uniswap V4's position validation to reject the operation:
This can happen when we initial a hook for a coin, and our initial liquidity position calculations result in adding liquidity twice to a position with the same ticks.
This behavior can be seen in the uniswap Position.t.sol test:
Fix Applied
Added empty position check in
V4Liquidity.solline ~201-210:Impact Resolved
🤖 Generated with Claude Code