Platform: Code4rena
Start Date: 01/08/2022
Pot Size: $50,000 USDC
Total HM: 26
Participants: 133
Period: 5 days
Judge: Jack the Pug
Total Solo HM: 6
Id: 151
League: ETH
Rank: 128/133
Findings: 1
Award: $21.72
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: c3phas
Also found by: 0x040, 0x1f8b, 0xA5DF, 0xNazgul, 0xSmartContract, 0xSolus, 0xc0ffEE, 0xkatana, 0xsam, 8olidity, Aymen0909, Bnke0x0, CertoraInc, Chinmay, Chom, CodingNameKiki, Deivitto, Dravee, ElKu, Extropy, Fitraldys, Funen, GalloDaSballo, Guardian, IllIllI, JC, Lambda, MEP, Metatron, MiloTruck, Noah3o6, NoamYakov, PaludoX0, ReyAdmirado, Rohan16, Rolezn, Ruhum, Sm4rty, SooYa, TomJ, Tomio, Waze, _Adam, __141345__, a12jmx, ajtra, ak1, apostle0x01, asutorufos, ballx, benbaessler, bharg4v, bobirichman, brgltd, cryptonue, defsec, delfin454000, dharma09, djxploit, durianSausage, eierina, erictee, fatherOfBlocks, gerdusx, gogo, hake, hyh, ignacio, jag, kaden, kyteg, lucacez, mics, minhquanym, oyc_109, pfapostol, rbserver, ret2basic, robee, rokinot, sach1r0, saian, samruna, scaraven, sikorico, simon135, supernova, teddav, tofunmi, zeesaw
21.7232 USDC - $21.72
Issue | Instances |
---|---|
1. Use ++i instead of i++ | 14 |
2. Use ++i instead of i += 1 | 4 |
3. Let the default value be applied to variables initialized to the default value | 8 |
4. Use != 0 instead of > 0 for a uint | 1 |
5. 5. Use custom errors instead of require() to save gas | 74 |
++i
instead of i++
This is especially relevant for the use of i++
in for
loops. This saves 6 gas per loop.
There are 14 instances of this issue:
++i
instead of i += 1
Similar to 1. ++i
uses less gas compared to i+=1
.
There are 4 instances of this issue:
Letting the default value of 0
, false
be initialized to variables costs less gas compared to initializing it to these default values.
There are 8 instances of this issue:
uint
Since the integers are unsigned, != 0
and > 0
are equivalent. Using != 0
is 6 gas per instance cheaper than > 0
There is 1 instance of this issue:
require()
to save gasCustom errors are available from solidity version 0.8.4. The instances below match or exceed that version.
There are 74 instances of this issue: