Platform: Code4rena
Start Date: 11/08/2022
Pot Size: $40,000 USDC
Total HM: 8
Participants: 108
Period: 4 days
Judge: hickuphh3
Total Solo HM: 2
Id: 152
League: ETH
Rank: 103/108
Findings: 1
Award: $20.60
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Dravee
Also found by: 0x040, 0x1f8b, 0xDjango, 0xHarry, 0xNazgul, 0xSmartContract, 0xbepresent, 0xkatana, Amithuddar, Aymen0909, Bnke0x0, Chom, CodingNameKiki, Deivitto, DevABDee, Diraco, ElKu, Fitraldys, Funen, IllIllI, JC, LeoS, Metatron, MiloTruck, Noah3o6, ReyAdmirado, Rohan16, Rolezn, Saw-mon_and_Natalie, Sm4rty, SpaceCake, TomJ, Tomio, Trabajo_de_mates, Waze, Yiko, __141345__, ajtra, apostle0x01, bobirichman, brgltd, bulej93, c3phas, cRat1st0s, carlitox477, d3e4, durianSausage, erictee, fatherOfBlocks, gerdusx, gogo, hakerbaya, ignacio, jag, joestakey, ladboy233, medikko, mics, newfork01, oyc_109, pfapostol, robee, rvierdiiev, sach1r0, saian, samruna, sikorico, simon135, wagmi, zeesaw, zkhorse, zuhaibmohd
20.5997 USDC - $20.60
constant
or immutable
will cost more gas rather than use default value of zero.If you not overwritte the default value you will save 8 gas for stack variables and more for storage and memory variables.
There are 8 instances of this issue:
File: /contracts/PercentSplitETH.sol: 115: for (uint256 i = 0; i < _shares.length; ++i) { 135: for (uint256 i = 0; i < shares.length; ++i) { 320: for (uint256 i = 0; i < shares.length; ++i) {
File: /contracts/libraries/BytesLibrary.sol 25: for (uint256 i = 0; i < 20; ++i) { 44: for (uint256 i = 0; i < 4; ++i) {
File: /contracts/mixins/shared/MarketFees.sol 126: for (uint256 i = 0; i < creatorRecipients.length; ++i) { 198: for (uint256 i = 0; i < creatorShares.length; ++i) { 484: for (uint256 i = 0; i < creatorRecipients.length; ++i) {
++i
/i++
should be unchecked{++i}
/unchecked{i++}
in for
-loopsNot using a unchecked{++i}
/unchecked{i++}
will cost more gas because the default compiler overflow and underflow safety checks. This is true from version 0.8.0, code below match that requirments.
There are 2 instances of this issue:
File: /contracts/PercentSplitETH.sol: 115: for (uint256 i = 0; i < _shares.length; ++i) { 320: for (uint256 i = 0; i < shares.length; ++i) {
Use of bit shifting operations are more cheap than normal multiplication/division operations.
There are 3 instances of this issue:
File: /contracts/FETH.sol 210: lockupInterval = _lockupDuration / 24; 211: if (lockupInterval * 24 != _lockupDuration || _lockupDuration == 0) {
File: ./contracts/libraries/LockedBalance.sol 100: uint256 lockupMetadata = lockups.lockups[index / 2];
#0 - HardlyDifficult
2022-08-19T15:01:54Z
Don't initialize variables with default values.
Invalid. This optimization technique is no longer applicable with the current version of Solidity.
Use of ++i/i++ should be unchecked{++i}/unchecked{i++}in for-loops
Agree and will fix. But this file was out of scope.
If you use bit shifting will save some gas
Both examples were out of scope.