Platform: Code4rena
Start Date: 03/03/2023
Pot Size: $90,500 USDC
Total HM: 4
Participants: 42
Period: 7 days
Judge: 0xean
Total Solo HM: 2
Id: 219
League: ETH
Rank: 37/42
Findings: 1
Award: $53.96
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: JCN
Also found by: 0x6980, 0xSmartContract, 0xnev, Madalad, Phantasmagoria, Rageur, RaymondFam, ReyAdmirado, Rolezn, Sathish9098, atharvasama, descharre, hunter_w3b, matrix_0wl, saneryee, volodya, yongskiws
53.963 USDC - $53.96
In Solidity 0.8+, there’s a default overflow check on unsigned integers. It’s possible to uncheck this in for-loops and save some gas at each iteration, but at the cost of some code readability, as this uncheck cannot be made inline.
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.
The code should be refactored such that they no longer exist, or the block should do something useful, such as emitting an event or reverting.
If the functions are required by an interface, the contract should inherit from that interface and use the override keyword.
Not inlining costs 20 to 40 gas because of two extra JUMP instructions and additional stack operations needed for function calls.
It is not necessary to have both a named return and a return statement.
Contracts are allowed to override their parents’ functions and change the visibility from external to public and can save gas by doing so.
Modifiers make code more elegant, but cost more than normal functions.
Use abi.encodePacked() where possible to save gas.
#0 - c4-judge
2023-03-12T17:41:44Z
0xean marked the issue as grade-b
#1 - c4-sponsor
2023-03-15T08:46:30Z
novaknole20 marked the issue as sponsor acknowledged