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: 29/52
Findings: 1
Award: $117.51
π 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
117.508 USDC - $117.51
wrong calculation in chainlinkPriceChangeMax leads to be unfair
function _chainlinkPriceChangeAboveMax( ChainlinkResponse memory _currentResponse, ChainlinkResponse memory _prevResponse ) internal pure returns (bool) { uint256 minPrice = EbtcMath._min(_currentResponse.answer, _prevResponse.answer); uint256 maxPrice = EbtcMath._max(_currentResponse.answer, _prevResponse.answer); /* * Use the larger price as the denominator: * - If price decreased, the percentage deviation is in relation to the the previous price. * - If price increased, the percentage deviation is in relation to the current price. */ uint256 percentDeviation = maxPrice > 0 ? ((maxPrice - minPrice) * EbtcMath.DECIMAL_PRECISION) / maxPrice : 0; // Return true if price has more than doubled, or more than halved. return percentDeviation > MAX_PRICE_DEVIATION_FROM_PREVIOUS_ROUND; }
calculation will be unfair when price is increased , max price is used in denominator SO percentage will be less than percentage of that when it's decreased . let's say current price is 5000 and prev price is 4000 , percentage will be 1000/5000 = 20 % , when price is dropped 1000 instead of increase , calculation will be 1000/4000= 25%
manual view
user previous price instead of max price
Math
#0 - c4-pre-sort
2023-11-15T10:21:03Z
bytes032 marked the issue as insufficient quality report
#1 - bytes032
2023-11-15T10:21:07Z
Invalid
#2 - c4-sponsor
2023-11-20T12:59:57Z
GalloDaSballo marked the issue as disagree with severity
#3 - GalloDaSballo
2023-11-20T13:00:00Z
Maybe QA
#4 - jhsagd76
2023-11-25T13:07:52Z
valid, but why high? max change cap from 50% -> 40% means nothing
#5 - c4-judge
2023-11-25T13:08:06Z
jhsagd76 changed the severity to QA (Quality Assurance)
#6 - c4-judge
2023-11-25T13:08:41Z
jhsagd76 marked the issue as grade-b
#7 - c4-judge
2023-11-28T09:40:34Z
jhsagd76 marked the issue as grade-a