Platform: Code4rena
Start Date: 08/03/2023
Pot Size: $60,500 USDC
Total HM: 2
Participants: 123
Period: 7 days
Judge: hansfriese
Id: 220
League: ETH
Rank: 66/123
Findings: 2
Award: $48.97
π Selected for report: 0
π Solo Findings: 0
π Selected for report: 0xSmartContract
Also found by: 0x1f8b, 0x6980, 0xAgro, 0xSolus, 0xhacksmithh, 0xkazim, ABA, BPZ, BowTiedOriole, ChainReview, DadeKuma, DeFiHackLabs, Deathstore, DevABDee, Diana, Dravee, Dug, Englave, Go-Langer, Haipls, IceBear, Inspex, Jeiwan, Kek, Kresh, Madalad, MatricksDeCoder, MyFDsYours, RaymondFam, Rolezn, SAAJ, Sathish9098, Taloner, Udsen, Viktor_Cortess, atharvasama, ayden, brgltd, btk, carlitox477, catellatech, chaduke, codeislight, deadrxsezzz, descharre, erictee, fatherOfBlocks, favelanky, glcanvas, handsomegiraffe, jasonxiale, jekapi, joestakey, lemonr, luxartvinsec, martin, matrix_0wl, minhquanym, mrpathfindr, nadin, oyc_109, parsely, peanuts, pfedprog, rbserver, rokso, saian, santipu_, scokaf, slvDev, tsvetanovv, ubl4nk, ulqiorra, yamapyblack, zaskoh
29.6697 USDC - $29.67
Precaution should be taken in using solidity latest released version that can impact the project based on reason of unknown bugs.
Link to the code:
Address(0) check is missing in function, consider applying check to ensure tokens or tickets arenβt minted to the zero address.
Link to the code:
Zero-address check should be used in the constructors, to avoid the risk of setting a storage variable as address(0) at deploying time.
Link to the code:
Locking pragma version ensures contracts are not being deployed on an outdated compiler version.
Link to the code:
Functions in which important state change takes place should emit relevant changes.
Link to the code:
#0 - c4-judge
2023-03-17T02:55:35Z
hansfriese marked the issue as grade-c
#1 - c4-judge
2023-04-04T09:21:23Z
hansfriese marked the issue as grade-b
π Selected for report: JCN
Also found by: 0x1f8b, 0xSmartContract, 0xSolus, 0xhacksmithh, 0xnev, Angry_Mustache_Man, Aymen0909, Diana, Flora, Inspex, Madalad, MatricksDeCoder, MiniGlome, R-Nemes, RaymondFam, ReyAdmirado, Rolezn, SAAJ, Sathish9098, Shubham, Udsen, Viktor_Cortess, arialblack14, atharvasama, ayden, c3phas, carlitox477, descharre, dharma09, durianSausage, fatherOfBlocks, ginlee, glcanvas, hunter_w3b, leopoldjoy, matrix_0wl, mrpathfindr, nadin, oyc_109, pipoca, schrodinger, slvDev, ulqiorra, volodya
19.3029 USDC - $19.30
This report focuses on Neo Tokyo contest, in context of various improvements that can be made in terms of gas cost.
Some of the opportunities identified for improving gas efficiency throughout the codebase of Neo Tokyo are categorised into 05 main areas; with further multiple instances in each of the category.
[G-01] 0perator assignment is more gas efficient than compound assignment (22 Instances) [G-02] Immutable has more gas efficiency than constant (12 Instances) [G-03] Multiple mappings can be combine into a single one (11 Instances) [G-04] Public visibility consumes more gas as compared to external in functions (01 Instance) [G-05] Uint/int lower than 32 bytes consumes incurs overhead (03 Instances)
β
Compound assignment operators (+= / -=) are more expensive in terms of gas consumption and needs to be avoided.
Operator assignments (a = a + b / a - b) are preferable in terms of gas optimization.
Link to the Code:
Using immutable instead of constant, save more gas due to avoiding storage access for state variables.
Variable values are set through constructor when using immutable, which also eliminates the need of assigning initial values to state variable making them more efficient in terms of gas cost
Link to the Code:
When multiple mappings are used in same function, itβs better to combined them into a single mapping using a struct.
Combined mapping reduces storage slot per mapping and also are cheaper in terms of associated stack operations calculation carried out.
Link to the Code:
Functions with public visibility, if not called within the contract needed to be changed external.
Link to the Code:
Contract gas usage increases as EVM standard operation are of 32 bytes. If any element is smaller than 32 bytes (i.e.; 256 bits) it will cause EVM to consume more gas which can be around 12 gas depending on size for reducing the size to given output like uint8.
Link to the Code:
#0 - c4-judge
2023-03-17T03:59:34Z
hansfriese marked the issue as grade-b