Platform: Code4rena
Start Date: 21/04/2022
Pot Size: $75,000 USDC
Total HM: 7
Participants: 45
Period: 7 days
Judge: 0xean
Total Solo HM: 5
Id: 111
League: ETH
Rank: 40/45
Findings: 1
Award: $67.07
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xkatana
Also found by: 0v3rf10w, 0x1f8b, 0xNazgul, 0xmint, CertoraInc, Dravee, Fitraldys, Funen, IllIllI, NoamYakov, Scocco, Tomio, catchup, csanuragjain, defsec, delfin454000, djxploit, fatima_naz, gzeon, joestakey, joshie, kebabsec, nahnah, oyc_109, rayn, robee, rotcivegaf, saian, samruna, sorrynotsorry, teryanarmen, z3s
67.0735 USDC - $67.07
This implementation below can saving more gas instead
##Recommendation Mitigation
struct Weight { uint32 currentCycle; uint112 storedWeight; uint112 currentWeight; }
uint256 i = 0
into uint i
for saving more gasusing this implementation can saving more gas for each loops.
##Tool Used Manual Review
##Recommended Mitigation Change it
##Occurances
src/token/ERC20MultiVotes.sol#L346 src/token/ERC20Gauges.sol#L134 src/token/ERC20Gauges.sol#L184 src/token/ERC20Gauges.sol#L307 src/token/ERC20Gauges.sol#L384 src/token/ERC20Gauges.sol#L564
= 0
If a variable was not set/initialized, it is assumed to have default value to 0
this implementation was used for saving more gas by removing = 0
##TOOLS USED Manual Review
##Mitigation Step
Remove = 0
#0 - thomas-waite
2022-07-14T15:52:36Z
Much prefer explicitly sized variables over uint
even if it does cost a bit more gas. How does that struct difference save gas?