_canFinalizeWithdrawRequest returns false on an edge case
Summary
Unstake is possible on block.timestamp == userCooldown.cooldownEnd on sUSDe, but _canFinalizeWithdrawRequest returns false on that timestamp. So unstake/finalizing withdrawal is not possible due to wrong use of < instead of <=.
Vulnerability Detail
Look at _canFinalizeWithdrawRequest, it returns true if userCooldown.cooldownEnd < block.timestamp. Bit it should return true even if userCooldown.cooldownEnd == block.timestamp. So use <= instead of just <.
If you look at unstake below, it allows to unstake even if block.timestamp >= userCooldown.cooldownEnd.
Unstake is possible on block.timestamp == userCooldown.cooldownEnd on sUSDe, but _canFinalizeWithdrawRequest returns false. So unstake/finalizing withdrawal is not possible due to the wrong use of < instead of <=.
Ironsidesec
Medium
_canFinalizeWithdrawRequest
returns false on an edge caseSummary
Unstake is possible on
block.timestamp == userCooldown.cooldownEnd
on sUSDe, but_canFinalizeWithdrawRequest
returns false on that timestamp. So unstake/finalizing withdrawal is not possible due to wrong use of < instead of <=.Vulnerability Detail
Look at
_canFinalizeWithdrawRequest
, it returns true ifuserCooldown.cooldownEnd < block.timestamp
. Bit it should return true even ifuserCooldown.cooldownEnd == block.timestamp
. So use <= instead of just <. If you look atunstake
below, it allows to unstake even ifblock.timestamp >= userCooldown.cooldownEnd
.https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/14d3eaf0445c251c52c86ce88a84a3f5b9dfad94/leveraged-vaults-private/contracts/vaults/staking/protocols/Ethena.sol#L177
https://etherscan.io/address/0x9D39A5DE30e57443BfF2A8307A4256c8797A3497#code#F1#L84
Impact
Unstake is possible on
block.timestamp == userCooldown.cooldownEnd
on sUSDe, but_canFinalizeWithdrawRequest
returns false. So unstake/finalizing withdrawal is not possible due to the wrong use of < instead of <=.Code Snippet
https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/14d3eaf0445c251c52c86ce88a84a3f5b9dfad94/leveraged-vaults-private/contracts/vaults/staking/protocols/Ethena.sol#L177
https://etherscan.io/address/0x9D39A5DE30e57443BfF2A8307A4256c8797A3497#code#F1#L84
Tool used
Manual Review
Recommendation
https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/14d3eaf0445c251c52c86ce88a84a3f5b9dfad94/leveraged-vaults-private/contracts/vaults/staking/protocols/Ethena.sol#L177