Platform: Code4rena
Start Date: 04/11/2022
Pot Size: $42,500 USDC
Total HM: 9
Participants: 88
Period: 4 days
Judge: 0xean
Total Solo HM: 2
Id: 180
League: ETH
Rank: 71/88
Findings: 1
Award: $21.13
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0x1f8b
Also found by: 0xSmartContract, 0xdeadbeef, Aymen0909, B2, Bnke0x0, Deivitto, Diana, Dinesh11G, JC, RaymondFam, ReyAdmirado, Rolezn, Sathish9098, TomJ, ajtra, aviggiano, chaduke, cryptostellar5, djxploit, gianganhnguyen, gogo, halden, karanctf, leosathya, lukris02, mcwildy, oyc_109, ret2basic, skyle, slowmoses
21.132 USDC - $21.13
cache a.timings
in memory
File SizeSealed.sol: 29-37
if (block.timestamp < a.timings.startTimestamp) { // 1 SLOAD if (_state != States.Created) revert InvalidState(); } else if (block.timestamp < a.timings.endTimestamp) { // 2 SLOAD if (_state != States.AcceptingBids) revert InvalidState(); } else if (a.data.lowestQuote != type(uint128).max) { if (_state != States.Finalized) revert InvalidState(); } else if (block.timestamp <= a.timings.endTimestamp + 24 hours) { // 3 SLOAD if (_state != States.RevealPeriod) revert InvalidState(); } else if (block.timestamp > a.timings.endTimestamp + 24 hours) { // 4 SLOAD
idToAuction[auctionId]
can be stored first in memory and after getting/setting of all variables can be stored in storage
File SizeSealed.sol: 86-92, 131, 181, 221, 246, 337-338, 359-360, 392, 418-419, 456
The majority of Solidity for loops increment a uint256 variable that starts at 0. These increment operations never need to be checked for over/underflow because the variable will never reach the max number of uint256 (will run out of gas long before that happens). The default over/underflow check wastes gas in every iteration of virtually every for loop . eg.
uint128 unsoldBase = data.totalBaseAmount - data.filledBase;
File SizeSealed.sol: 319
is checked in 313 line
currentTime - vestingStart
and vestingEnd - vestingStart
can be unchecked
File CommonTokenMath.sol: 65
File SizeSealed.sol: 373
#0 - c4-judge
2022-11-10T02:08:46Z
0xean marked the issue as grade-b