code-423n4 / 2024-01-salty-findings

4 stars 3 forks source link

Rounding Errors #996

Closed c4-bot-5 closed 5 months ago

c4-bot-5 commented 5 months ago

Lines of code

https://github.com/code-423n4/2024-01-salty/blob/main/src/price_feed/PriceAggregator.sol#L139

Vulnerability details

Impact

Detailed description of the impact of this finding. Rounding Errors: The contract calculates the average price as the sum of two prices divided by two. This can introduce rounding errors, especially if the prices are odd numbers.

Proof of Concept

Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.

uint256 averagePrice = ( priceA + priceB ) / 2;

Tools Used

Recommended Mitigation Steps

use some other method for odd numbers.

Assessed type

Context

c4-judge commented 5 months ago

Picodes marked the issue as unsatisfactory: Insufficient proof