Submitted by hash
Deposits will be unwithdrawable from the lockbox.
If the entire liquidity of a position has been removed, the withdraw function calls the updateFeesAndRewards function on the Orca pool before attempting to close the position.
https://github.com/code-423n4/2023-12-autonolas/blob/2a095eb1f8359be349d23af67089795fb0be4ed1/lockbox-solana/solidity/liquidity_lockbox.sol#L277-L293
This is faulty as the updateFeesAndRewards function will always revert if the positions liquidity is 0.
https://github.com/code-423n4/2023-12-autonolas/blob/2a095eb1f8359be349d23af67089795fb0be4ed1/lockbox-solana/solidity/interfaces/whirlpool.sol#L198
updatefeesand_rewards -> calculatefeeandrewardgrowths -> _calculatemodifyliquidity
https://github.com/orca-so/whirlpools/blob/3206c9cdfbf27c73c30cbcf5b6df2929cbf87618/programs/whirlpool/src/manager/liquidity_manager.rs#L97-L99
Since the withdrawal positions are chosen sequentially, only a maximum of (first positions liquidity - 1) amount of liquidity can be withdrawn.
https://gist.github.com/10xhash/a687ef66de8210444a41360b86ed4bca
Avoid the update_fees_and_rewards call completely since fees and rewards would be updated in the decreaseLiquidity call.
kupermind commented:
Note: See full discussion here.
