The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Valid

Precision Loss in Asset Distribution Calculation

Summary

The distributeAssets function in the LiquidationPool contract may suffer from precision loss due to the order of operations involving division and multiplication. This could result in inaccurate calculations when distributing assets to holders based on their stakes.

Vulnerability Details

In the distributeAssets function, the calculation of _portion involves division followed by multiplication, which can lead to precision loss. The relevant code snippet is as follows:

uint256 _portion = asset.amount * _positionStake / stakeTotal;
_portion = _portion * _position.EUROs / costInEuros;

The purpose of this calculation is to determine the portion of an asset to be distributed to a specific holder based on their stake. However, due to the order of operations, the intermediate result _portion may lose precision, impacting the accuracy of the final distribution.

Impact

The precision loss in the asset distribution calculation may result in inaccurate distribution of assets to holders, potentially affecting the fairness and reliability of the liquidation pool system.

Tools Used

Manual

Recommendations

The order of operations should be adjusted to prioritize multiplication before division.

uint256 _portion = (asset.amount * _positionStake * _position.EUROs) / (stakeTotal * costInEuros);
Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

precision

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.