You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Wrong way of rounding when expectedAmounts calculation on withdrawal processing
Summary
When expectedAmounts are calculated, the denominator must be rounded up, but here already using rounded down denominator is used in a denominator which will inflate the end value.
Vulnerability Detail
ratiosX96Value in L580 below is calculated with mulDiv which will round down mostly due to volatile prices, and more volatile if underlying tokens > 1.
this ratiosX96Valuev is used to calculate coefficientX96 in denominator on L536 below. So using a rounded down value will inflate the `` value.
This inflated coefficientX96 is used as a numerator on L545 below calculating the expectedAmounts. Which will be inflated and rounding is in favor of a user. So he might get more than he deserves and also this will definitely revert when last withdrawer tries to withdraw his Lp, it might revert.
Inflated coefficientX96 is used as numerator on L545 calculating the expectedAmounts. Which will be inflated and rounding is in favor of user. So he might get more than he deserves and also this will definitely revert when last withdrawer tries to withdraw his Lp, it might revert.
The text was updated successfully, but these errors were encountered:
sherlock-admin4
changed the title
Curved Powder Rooster - Lack of Access control for convertAndDeposit
Wrong way of rounding when expectedAmounts calculation on withdrawal processing
Jun 28, 2024
github-actionsbot
changed the title
Wrong way of rounding when expectedAmounts calculation on withdrawal processing
Beautiful Teal Kookaburra - Wrong way of rounding when expectedAmounts calculation on withdrawal processing
Jul 6, 2024
sherlock-admin3
changed the title
Beautiful Teal Kookaburra - Wrong way of rounding when expectedAmounts calculation on withdrawal processing
Ironsidesec - Wrong way of rounding when expectedAmounts calculation on withdrawal processing
Jul 15, 2024
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Ironsidesec
Medium
Wrong way of rounding when
expectedAmounts
calculation on withdrawal processingSummary
When
expectedAmounts
are calculated, the denominator must be rounded up, but here already using rounded down denominator is used in a denominator which will inflate the end value.Vulnerability Detail
ratiosX96Value
in L580 below is calculated withmulDiv
which will round down mostly due to volatile prices, and more volatile if underlying tokens > 1.ratiosX96Valuev
is used to calculatecoefficientX96
in denominator on L536 below. So using a rounded down value will inflate the `` value.coefficientX96
is used as a numerator on L545 below calculating theexpectedAmounts
. Which will be inflated and rounding is in favor of a user. So he might get more than he deserves and also this will definitely revert when last withdrawer tries to withdraw his Lp, it might revert.https://github.com/sherlock-audit/2024-06-mellow/blob/26aa0445ec405a4ad637bddeeedec4efe1eba8d2/mellow-lrt/src/Vault.sol#L476-L534
Impact
Inflated
coefficientX96
is used as numerator on L545 calculating theexpectedAmounts
. Which will be inflated and rounding is in favor of user. So he might get more than he deserves and also this will definitely revert when last withdrawer tries to withdraw his Lp, it might revert.Code Snippet
https://github.com/sherlock-audit/2024-06-mellow/blob/26aa0445ec405a4ad637bddeeedec4efe1eba8d2/mellow-lrt/src/Vault.sol#L476-L534
https://github.com/sherlock-audit/2024-06-mellow/blob/26aa0445ec405a4ad637bddeeedec4efe1eba8d2/mellow-lrt/src/Vault.sol#L530
Tool used
Manual Review
Recommendation
Use
mulDivUp
https://github.com/sherlock-audit/2024-06-mellow/blob/26aa0445ec405a4ad637bddeeedec4efe1eba8d2/mellow-lrt/src/Vault.sol#L530
Duplicate of #61
The text was updated successfully, but these errors were encountered: