Platform: Code4rena
Start Date: 24/10/2023
Pot Size: $149,725 USDC
Total HM: 7
Participants: 52
Period: 21 days
Judge: ronnyx2017
Total Solo HM: 2
Id: 300
League: ETH
Rank: 50/52
Findings: 1
Award: $19.71
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: SpicyMeatball
Also found by: 0xBeirao, 7ashraf, LokiThe5th, OMEN, TrungOre, alexzoid, alpha, bdmcbri, ether_sky, fatherOfBlocks, ge6a, hihen, hunter_w3b, jasonxiale, ladboy233, lsaudit, niroh, nobody2018, nonseodion, peanuts, prapandey031, shaka, twcctop, twicek, wangxx2026
19.712 USDC - $19.71
PriceFeed constructor doesn't check fallbackCaller
state, it assumes fallbackCaller
is trusted without any check. It may set the wrong state of oracle status.
status is to show the status of Oracle in init or previous call fetchPrice
.It affects the return value of price and trusted status of oracle.Every time of status change should check current oracle return value and this will guarantee next call of fetchPrice
have a right status to refer to.
But in constructor
,status is set to chainlinkWorking
,and it doesn't check the state of fallback oracle.It assume fallback oracle works well. It will provide a bad reference to next call of fetchPrice
, and it's possible to return imprecise oracle value.
If don't check fallback oracle value,the status should be usingChainlinkFallbackUntrusted
manual
diff --git a/packages/contracts/contracts/PriceFeed.sol b/packages/contracts/contracts/PriceFeed.sol index ef244d4..5f7438a 100644 --- a/packages/contracts/contracts/PriceFeed.sol +++ b/packages/contracts/contracts/PriceFeed.sol @@ -85,7 +85,7 @@ contract PriceFeed is BaseMath, IPriceFeed, AuthNoOwner { _storeChainlinkPrice(chainlinkResponse.answer); // Explicitly set initial system status after `require` checks - status = Status.chainlinkWorking; + status = Status.usingChainlinkFallbackUntrusted; } // --- Functions --- ~
Oracle
#0 - bytes032
2023-11-15T15:08:25Z
OOS
#1 - c4-pre-sort
2023-11-15T15:08:29Z
bytes032 marked the issue as insufficient quality report
#2 - bytes032
2023-11-16T06:40:16Z
#3 - c4-pre-sort
2023-11-16T06:41:21Z
bytes032 marked the issue as duplicate of #218
#4 - c4-judge
2023-11-26T00:43:08Z
jhsagd76 changed the severity to QA (Quality Assurance)
#5 - c4-judge
2023-11-27T11:05:20Z
jhsagd76 marked the issue as grade-b