GMX's latestRoundData might return stale or incorrect results
Summary
GMX's latestRoundData() is used but there is no check if the return value indicates stale data and round completeness.
Vulnerability Detail
The GLPOracle.getEthPrice function uses GMX's latestRoundData() to get the latest price.
However, there is not enough check if the return value indicates stale data.
Impact
A stale price can cause the malfunction of price oracle and the function getEthPrice() can be invalid or outdated.
If the market price of the token drops very quickly ("flash crashes"), and GMX's feed does not get updated in time, the smart contract will continue to believe the token is worth more than the market value thus affecting users (griefing).
w42d3n
medium
GMX's latestRoundData might return stale or incorrect results
Summary
GMX's
latestRoundData()
is used but there is no check if the return value indicates stale data and round completeness.Vulnerability Detail
The GLPOracle.getEthPrice function uses GMX's latestRoundData() to get the latest price. However, there is not enough check if the return value indicates stale data.
Impact
A stale price can cause the malfunction of price oracle and the function getEthPrice() can be invalid or outdated.
If the market price of the token drops very quickly ("flash crashes"), and GMX's feed does not get updated in time, the smart contract will continue to believe the token is worth more than the market value thus affecting users (griefing).
Code Snippet
https://github.com/sherlock-audit/2023-01-sentiment/blob/main/oracle/src/gmx/GLPOracle.sol#L47-L58
Tool used
Manual Review
Recommendation
Consider adding checks to validate data feed:
Duplicate of #31