sherlock-audit / 2024-08-sentiment-v2-judging

0 stars 0 forks source link

0xBeastBoy - Incorrect Decimals Check in Chainlink Price Feed Setup #267

Closed sherlock-admin4 closed 5 days ago

sherlock-admin4 commented 3 weeks ago

0xBeastBoy

Medium

Incorrect Decimals Check in Chainlink Price Feed Setup

Reference

If a price feed with a different decimal configuration is provided, this assertion will fail, causing the transaction to revert. For example, if a Chainlink feed has 6 decimals instead of the assumed 8 or 18, the function will revert, making it impossible to set the feed. This issue can prevent onboarding critical assets, lead to disruptions in protocol operations, and delay the configuration of price feeds.

This issue becomes more concerning when dealing with diverse assets that rely on Chainlink feeds, as differing decimals are common across various assets. The rigid assumption made in the current implementation not only limits feed configurability but also introduces potential operational risks when integrating new feeds. This could cause significant disruptions, especially in environments where time-sensitive updates are essential for maintaining accurate asset valuations.

Impact

The protocol will be unable to set assets with feeds having different decimals, leading to missing or incorrect price data. Even it will cause continous reverts and restrict the protocol to only a few limited feeds.

Tool used

Manual Review

Recommendation

Remove the fixed decimal assertion and dynamically handle feeds with varying decimals. Instead of assuming a fixed decimal configuration, fetch the feed’s decimals during setup and adjust calculations accordingly.

z3s commented 5 days ago

Low/Info; This does not cause any issues