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: 124/125
Findings: 1
Award: $4.23
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: RED-LOTUS-REACH
Also found by: 0x3b, 0x4non, 0xCiphky, 0xDING99YA, 0xDetermination, 0xE1, 0xG0P1, 0xStalin, 0xWaitress, 0xbrett8571, 0xhacksmithh, 0xkazim, 0xmuxyz, 0xweb3boy, 14si2o_Flint, AlexCzm, Alhakista, Bube, Bughunter101, Deekshith99, Eeyore, Giorgio, HChang26, InAllHonesty, JP_Courses, KmanOfficial, MatricksDeCoder, Mike_Bello90, MrPotatoMagic, Naubit, QiuhaoLi, RHaO-sec, Raihan, Rolezn, SUPERMAN_I4G, Shubham, Silverskrrrt, Strausses, T1MOH, Topmark, Tripathi, Watermelon, _eperezok, aakansha, auditsea, audityourcontracts, ayden, carlos__alegre, castle_chain, cducrest, ch0bu, d23e, deadrxsezzz, deth, devival, erebus, fatherOfBlocks, halden, hassan-truscova, hpsb, hunter_w3b, imkapadia, immeas, jat, kaden, kaveyjoe, klau5, koxuan, kutugu, ladboy233, lanrebayode77, leasowillow, lsaudit, markus_ether, matrix_0wl, merlin, nemveer, ni8mare, nonseodion, oakcobalt, owadez, p_crypt0, pipidu83, piyushshukla, popular00, ppetrov, rjs, sandy, sl1, supervrijdag, tay054, thekmj, wahedtalash77, windhustler, zhaojie
4.2289 USDC - $4.23
public
function should be marked as external if not used in the contract itself
This does not impact gas fees or good functioning of the contract but will make the code more readable.
Instances: GaugeController.sol#L204-206
function change_gauge_weight(address _gauge, uint256 _weight) public onlyGovernance { _change_gauge_weight(_gauge, _weight); }
VotingEscrow.sol#L473-484
function balanceOf(address _owner) public view returns (uint256) { uint256 epoch = userPointEpoch[_owner]; if (epoch == 0) { return 0; } Point memory lastPoint = userPointHistory[_owner][epoch]; lastPoint.bias = lastPoint.bias - (lastPoint.slope * int128(int256(block.timestamp - lastPoint.ts))); if (lastPoint.bias < 0) { lastPoint.bias = 0; } return uint256(uint128(lastPoint.bias)); }
VotingEscrow.sol#L487-527
function balanceOfAt(address _owner, uint256 _blockNumber) public view returns (uint256) { require(_blockNumber <= block.number, "Only past block number"); // Get most recent user Point to block uint256 userEpoch = _findUserBlockEpoch(_owner, _blockNumber); if (userEpoch == 0) { return 0; } Point memory upoint = userPointHistory[_owner][userEpoch]; // Get most recent global Point to block uint256 maxEpoch = globalEpoch; uint256 epoch = _findBlockEpoch(_blockNumber, maxEpoch); Point memory point0 = pointHistory[epoch]; // Calculate delta (block & time) between user Point and target block // Allowing us to calculate the average seconds per block between // the two points uint256 dBlock = 0; uint256 dTime = 0; if (epoch < maxEpoch) { Point memory point1 = pointHistory[epoch + 1]; dBlock = point1.blk - point0.blk; dTime = point1.ts - point0.ts; } else { dBlock = block.number - point0.blk; dTime = block.timestamp - point0.ts; } // (Deterministically) Estimate the time at which block _blockNumber was mined uint256 blockTime = point0.ts; if (dBlock != 0) { blockTime = blockTime + ((dTime * (_blockNumber - point0.blk)) / dBlock); } // Current Bias = most recent bias - (slope * time since update) upoint.bias = upoint.bias - (upoint.slope * int128(int256(blockTime - upoint.ts))); if (upoint.bias >= 0) { return uint256(uint128(upoint.bias)); } else { return 0; } }
#0 - c4-judge
2023-08-22T14:24:01Z
alcueca marked the issue as grade-b