X12 - ratiosX96Value
rounds in favor of user and not vault
#61
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
X12
Medium
ratiosX96Value
rounds in favor of user and not vaultSummary
ratiosX96Value
is rounded down instead of up, causing withdrawals to favor users. This can slowly decrease the value in our vault, potentially leading to insolvency.Vulnerability Detail
ratiosX96Value
, calculated in calculateStack,is used as a denominator inside analyzeRequest to calculate
coefficientX96
and the user'sexpectedAmounts
.However, calculateStack rounds the denominator down (thanks to
mulDiv
) , which increasescoefficientX96
and thus increases what users withdraw.This is unwanted behavior in vaults. Rounding towards users decreases the vault's value and can ultimately cause insolvency. The previous audit found a similar issue in the deposit function - M1.
Impact
The vault may become insolvent or lose small amounts of funds with each withdrawal.
Code Snippet
Tool used
Manual Review
Recommendation
Round the value up instead of down, similar to how it's done inside deposit.
The text was updated successfully, but these errors were encountered: