Withdrawal rounds in favour of the caller on both conversions
- Severity
- Medium
- Affected components
- src/Vault.sol — withdraw(), lines 182–204, at commit a3f19c2
- Description
- withdraw() converts shares to assets rounding down, then burns the caller's shares rounding down as well. Both roundings favour the caller, so every withdrawal leaves the vault fractionally short against totalAssets(). deposit() already rounds in the vault's favour, so the two paths disagree. Any depositor can trigger it, and it becomes profitable once the rounding remainder exceeds gas, which happens as the vault grows.
- Recommendation
- Round the share burn up in withdraw(), matching the direction deposit() already uses. ERC-4626 specifies that rounding favour the vault on both paths. The change is one mulDiv rounding flag and does not alter the external interface.
- Team response
- Acknowledged. Fixed in c81be40 by rounding the share burn up, as recommended.
- Status
- Resolved. Fix verified at commit c81be40.