Platform: Code4rena
Start Date: 07/08/2023
Pot Size: $36,500 USDC
Total HM: 11
Participants: 125
Period: 3 days
Judge: alcueca
Total Solo HM: 4
Id: 274
League: ETH
Rank: 6/125
Findings: 1
Award: $2,133.21
🌟 Selected for report: 1
🚀 Solo Findings: 1
🌟 Selected for report: Franfran
2133.2145 USDC - $2,133.21
diff --git a/src/GaugeController.sol b/src/GaugeController.sol index 68b832a..1794639 100644 --- a/src/GaugeController.sol +++ b/src/GaugeController.sol @@ -250,7 +250,7 @@ contract GaugeController { uint256 old_sum_slope = points_sum[next_time].slope; points_weight[_gauge_addr][next_time].bias = Math.max(old_weight_bias + new_bias, old_bias) - old_bias; - points_sum[next_time].bias = Math.max(old_sum_bias + new_bias, old_sum_bias) - old_bias; + points_sum[next_time].bias = Math.max(old_sum_bias + new_bias, old_bias) - old_bias; if (old_slope.end > next_time) { points_weight[_gauge_addr][next_time].slope = Math.max(old_weight_slope + new_slope.slope, old_slope.slope) -
Originally posted by @iFrostizz in https://github.com/OpenCoreCH/test-squad-verwa/issues/111#issuecomment-1655611968
#0 - itsmetechjay
2023-08-09T21:45:01Z
As noted in the README for this audit:
This audit was preceded by a Code4rena Test Coverage competition, which integrates a swarm approach to smart contract unit test coverage.
While auditing was not the purpose of the testing phase, relevant and valuable findings reported during that phase will be considered. Auditors who identified vulnerabilities during the test coverage phase will be eligible for a share of the pot, with H/M findings identified reviewed and judged as solo findings.
As such, C4 staff have added the above finding that was submitted by FranFran on July 28, 2023 at 10:44AM CDT as part of the test coverage competition. Adding a "Medium severity" label as a placeholder, until this can be evaluated by the judge.
#1 - c4-pre-sort
2023-08-14T13:42:33Z
141345 marked the issue as low quality report
#2 - c4-pre-sort
2023-08-14T15:54:01Z
141345 marked the issue as remove high or low quality report
#3 - OpenCoreCH
2023-08-16T14:40:47Z
This was discovered during the testing contest and fixed before the auditing contest.
#4 - c4-sponsor
2023-08-16T14:40:51Z
OpenCoreCH marked the issue as sponsor confirmed
#5 - c4-judge
2023-08-22T14:28:17Z
alcueca marked the issue as satisfactory
#6 - alcueca
2023-08-26T21:35:21Z
@OpenCoreCH, since the warden didn't really submit a report, would you be so kind as to explain the impact of this bug?
#7 - OpenCoreCH
2023-08-28T08:53:33Z
The Math.max
there is an underflow protection for points_sum[next_time]
. This wrong implementation would have lead to an underflow in some edge cases (points_sum
is near 0 / low, i.e. there is not a lot of voting power in the system), preventing votes for the user. Because old_bias
decreases over time (and eventually reaches 0), the error would generally have been recoverable, but it could have taken some time.