Open c4-submissions opened 1 year ago
19 nc
Use ECDSA signatures instead of merkle trees
nc
Private functions used once can be inlined
d
Mappings used within a function more than once should be cached to save gas nc
Use assembly to write address/contract type storage values
i
Use assembly to validate msg.sender nc
Invert if-else statements that have a negation
nc
Assigning state variables directly with named struct constructors wastes gas
nc
Using constants directly, rather than caching the value, saves gas
d
Use selfdestruct in the constructor if the contract is one-time use i
Understand the trade-offs when choosing between internal functions and modifiers
nc
Use fallback or receive instead of deposit() when transferring Ether
x
Consider using alternatives to OpenZeppelin -
Using assembly to revert with an error message
nc
Test if a number is even or odd by checking the last bit instead of using a modulo operator nc
Don’t make variables public unless it is necessary to do so i
It is cheaper to use vanity addresses with leading zeros, this saves calldata gas cost. nc
Using private rather than public for constants, saves Gas
i
Using fixex bytes is cheaper than using string
nc
Always use Named Returns
nc
Can make the variable outside the loop to save gas
x
Emitting memory values instead of the storage one.
i
It is sometimes cheaper to cache calldata
nc
Empty blocks should be removed or emit something
i
Use storage pointers instead of memory where appropriate
nc
Use constants instead of type(uintx).max
x
abi.encode() is less efficient than abi.encodePacked()
x
Do not calculate constants
x
Do-While loops are cheaper than for loops
nc
Use assembly to perform efficient back-to-back calls
d
Short-circuit booleans
nc
Pre-increment and pre-decrement are cheaper than +1 ,-1 i
Use Clones for Cheap Contract Deployments
i
Use assembly to hash instead of solidity
i
Use hardcode address instead address(this)
nc
Use bytes.concat() instead of abi.encodePacked(), since this is preferred since 0.8.4
i
Admin functions no uses of the nonReentrant modifier
nc
Use Mappings instead of arrays
nc
array[index] += amount is cheaper than array[index] = array[index] + amount i
Expression `` is cheaper than new bytes(0)
d
Shorten the array rather than copying to a new one
nc
141345 marked the issue as sufficient quality report
GalloDaSballo marked the issue as grade-b
GalloDaSballo marked the issue as grade-a
See the markdown file with the details of this report here.