Platform: Code4rena
Start Date: 12/04/2023
Pot Size: $60,500 USDC
Total HM: 21
Participants: 199
Period: 7 days
Judge: hansfriese
Total Solo HM: 5
Id: 231
League: ETH
Rank: 173/199
Findings: 1
Award: $21.03
π Selected for report: 0
π Solo Findings: 0
π Selected for report: c3phas
Also found by: 0xDACA, 0xRB, 0xSmartContract, 0xhacksmithh, 0xnev, Aymen0909, BenRai, Breeje, DishWasher, Erko, EvanW, JCN, MohammedRizwan, NoamYakov, Polaris_tow, Proxy, Rageur, Raihan, RaymondFam, ReyAdmirado, SAAJ, Sathish9098, Satyam_Sharma, Udsen, __141345__, aria, codeslide, decade, fatherOfBlocks, hunter_w3b, karanctf, matrix_0wl, nadin, naman1778, niser93, pavankv, petrichor, pfapostol, sebghatullah, slvDev, trysam2003, xmxanuel
21.0255 USDC - $21.03
In Solididy, the opcode 'less or equal' doesn't exist. So the EVM will translate this by two distinct operation, first the inferior, and then the equal which cost more gas then a strict less.
Itβs cheaper to use global variable as compared to caching.
If the functions are required by an interface, the contract should inherit from that interface and use the override keyword.
Modifiers make code more elegant, but cost more than normal functions.
External calls are expensive. Consider caching.
Saves 6 gas per instance if using assembly to check for address(0).
assembly { if iszero(_addr) { mstore(0x00, "zero address") revert(0x00, 0x20) } }
When dealing with unsigned integer types, comparisons with != 0 are cheaper then with > 0. This change saves 6 gas per instance.
#0 - c4-judge
2023-05-16T14:32:56Z
hansfriese marked the issue as grade-b