The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: medium
Invalid

Chainlink's `latestRoundData` Might Return Stale or incorrect Results

Summary

The distributeAssets() function in the liquidationPool#DistributeAssets contract risks miscalculating LP rewards due to reliance on potentially inaccurate prices from Chainlink's latestRoundData(). This could lead to Liquidity providers experiencing loss or unfair distribution of rewards.

Vulnerability Details

The liquidationPool#DistributeAssets contract relies on Chainlink's latestRoundData() without verifying the returned values: priceEurUsd/Answer, timestamp, roundID, and answeredInRound. This can result in stale pricing data, as highlighted in the Chainlink Historical Data Documentation.

The distributeAssets() function, which distribute assets from liquidations to LP, is susceptible to reward miscalculations. If latestRoundData() provides inaccurate prices, stakers might face loss of rewards or receive unfairly distributed rewards, This can lead to reward issues because of these unreliable values.

Impact

Potential loss of rewards or unfair distribution of rewards due to unchecked values from the latestRoundData() API.

Tools Used

Manual

Recommendations

Make sure to add checks for stale data or implement an internal function that verifies the following values before returning a token's answer.

(uint80 roundID, int256 answer, uint256 timestamp, uint80 answeredInRound) = AggregatorV3Interface(eurUsd).latestRoundData();
require(answer > 0, "Chainlink price must be greater than 0");
require(answeredInRound >= roundID, "Stale price detected, please wait for an updated value");
require(timestamp != 0, "Round is not yet complete, try again later");
Updates

Lead Judging Commences

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

Chainlink-price

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

Chainlink-price

Support

FAQs

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