code-423n4 / 2022-12-tigris-findings

8 stars 4 forks source link

Gas Optimizations #608

Open code423n4 opened 1 year ago

code423n4 commented 1 year ago

See the markdown file with the details of this report here.

GalloDaSballo commented 1 year ago

Amazing progress honestly, very cool to see a report that feels custom made! Awesome to see you using my math as well, which makes things easier to check

Using immutable on variables that are only set in the constructor and never after (2.1k gas per var)

14.7k

Pack structs by putting data types that can be packed together next to each other.(Total SLOTS saved: 6 ) ~ 6 * 2k = 12K gas saved

I think only 2 are valid, rest are memory values 4k

Rest is minor, prob 2k at most

20.7k

c4-sponsor commented 1 year ago

GainsGoblin marked the issue as sponsor confirmed

GalloDaSballo commented 1 year ago

The result of a function call should be cached rather than re-calling the function Around 200 gas (100+ from balance, rest is negligible)

Storage Pointer 25 times 40 1k

Avoid contract existence checks by using solidity version 0.8.10 or later Invalid compiler is .17

Rest is minor, 200 gas I'd say

22100

c4-judge commented 1 year ago

GalloDaSballo marked the issue as grade-a