Platform: Code4rena
Start Date: 25/01/2023
Pot Size: $36,500 USDC
Total HM: 11
Participants: 173
Period: 5 days
Judge: kirk-baird
Total Solo HM: 1
Id: 208
League: ETH
Rank: 134/173
Findings: 1
Award: $11.33
π Selected for report: 0
π Solo Findings: 0
π Selected for report: IllIllI
Also found by: 0x1f8b, 0x4non, 0xAgro, 0xSmartContract, 0xhacksmithh, 0xngndev, Aymen0909, Bnke0x0, Breeje, Deivitto, Diana, Dug, Iurii3, LethL, MiniGlome, NoamYakov, RaymondFam, ReyAdmirado, Rolezn, SAAJ, adriro, ali, arialblack14, atharvasama, c3phas, carlitox477, catellatech, chaduke, cryptonue, cryptostellar5, ddimitrov22, dharma09, doublesharp, favelanky, georgits, glcanvas, gzeon, halden, horsefacts, jasonxiale, joestakey, karanctf, lukris02, matrix_0wl, nadin, navinavu, saneryee, shark, thekmj
11.3269 USDC - $11.33
This report focuses on RabbitHole 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 RabbitHole Quest Protocol are categorised into 03 main areas; with further instances in each of the category.
[G-01] Multiple mappings can be combined into a single one (04 Instances)
[G-02] 0perator assignment is more gas efficient than compound assignment (01 Instance)
[G-03] Functions with public visibility, if not called within the contract needed to be changed external (27 Instances)
β
When multiple mappings are used in same function, itβs better to combined them into a single mapping of an address 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:
Compound assignment operators (+= / -=) are more expensive in terms of gas consumption and needs to be avoided.
Operator assignment (a = a + b / a - b) is preferable in terms of increasing gas optimization.
Link to the Code:
Functions with public visibility, if not called within the contract needed to be changed external.
Link to the Code:
#0 - c4-judge
2023-02-15T21:51:56Z
kirk-baird marked the issue as grade-b