Platform: Code4rena
Start Date: 10/05/2022
Pot Size: $50,000 USDC
Total HM: 13
Participants: 100
Period: 5 days
Judge: HardlyDifficult
Total Solo HM: 1
Id: 122
League: ETH
Rank: 88/100
Findings: 1
Award: $30.09
š Selected for report: 0
š Solo Findings: 0
š Selected for report: IllIllI
Also found by: 0v3rf10w, 0x1f8b, 0x4non, 0xDjango, 0xNazgul, 0xf15ers, 0xkatana, 0xsanson, Bludya, BowTiedWardens, CertoraInc, Cityscape, DavidGialdi, FSchmoede, Fitraldys, Funen, Hawkeye, Kenshin, MadWookie, MaratCerby, MiloTruck, Picodes, RagePit, Tadashi, TerrierLover, TomFrenchBlockchain, VAD37, WatchPug, Waze, _Adam, antonttc, bobirichman, catchup, defsec, delfin454000, djxploit, ellahi, fatherOfBlocks, gzeon, hake, hansfriese, hickuphh3, horsefacts, ignacio, joestakey, jonatascm, mics, minhquanym, oyc_109, pmerkleplant, rfa, robee, rotcivegaf, samruna, shung, sikorico, simon135, z3s
30.091 USDC - $30.09
Making the uint[19] because they never change and the compiler doesn't know when the array is going to stop.So make them static and that will save gas and confusion. https://github.com/code-423n4/2022-05-cally/blob/a2eefbbe6db5b65e81bd1ecb992a401be217a3e6/contracts/src/Cally.sol#L86 https://github.com/code-423n4/2022-05-cally/blob/a2eefbbe6db5b65e81bd1ecb992a401be217a3e6/contracts/src/Cally.sol#L88 With out the change 0.01354192ETH With change 0.01339456ETH
Non Initialized variables are already zero bec the slot is not filled and when inlinzed gets stored in storage which is a lot of gas (sstore opcode which is 25000 gas) https://github.com/code-423n4/2022-05-cally/blob/a2eefbbe6db5b65e81bd1ecb992a401be217a3e6/contracts/src/Cally.sol#L91 https://github.com/code-423n4/2022-05-cally/blob/a2eefbbe6db5b65e81bd1ecb992a401be217a3e6/contracts/src/Cally.sol#L90 https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L126 https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L363 ā--------------------------------------------------------------------------------------------------------------------- Onlyowner function should be payable because payable does not check msg.value = 0 https://github.com/code-423n4/2022-05-cally/blob/a2eefbbe6db5b65e81bd1ecb992a401be217a3e6/contracts/src/Cally.sol#L115 https://github.com/code-423n4/2022-05-cally/blob/a2eefbbe6db5b65e81bd1ecb992a401be217a3e6/contracts/src/Cally.sol#L120
Cally.sol gas report
Deployment Cost ā Deployment Size ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāā¼āāāāāāāā¼āāāāāāāāā¼āāāāāāāāā¼āāāāāāāāāā¤
ā 5376231 ā 23430 ā ā ā ā
āāāāāāāāāāāāāāāāāā¼āāāāāāāā¼āāāāāāāāā¼āāāāāāāāā¼āāāāāāāāāā¤
ā setFee ā 2538 ā 16152 ā 24531 ā 24531 ā 5 ā
āāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāā¼āāāāāāāā¼āāāāāāāāā¼āāāāāāāāā¼āāāā
withdrawProtocolFees ā 2490 ā 4985 ā 4985 ā 7480 ā 2
Cally.sol gas report with all the changes
Deployment Cost ā Deployment Size ā ā ā ā ā āāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāā¼āāāāāāāā¼āāāāāāāāā¼āāāāāāāāā¼āāāāāāāāā⤠ā 5371031 ā 23404 ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāā¼āāāāāāāā¼āāāāāāāāā¼āāāāāāāāā¼āāāāāāāāā⤠ā setFee ā 2514 ā 16128 ā 24507 ā 24507 ā 5 ā āāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāā¼āāāāāāāā¼āāāāāāāāā¼āāāāāāāāā¼āāā
withdrawProtocolFees ā 2466 ā 4961 ā 4961 ā 7456 ā 2