Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gas Optimizations #608

Open
code423n4 opened this issue Dec 16, 2022 · 4 comments
Open

Gas Optimizations #608

code423n4 opened this issue Dec 16, 2022 · 4 comments
Labels
bug Something isn't working G (Gas Optimization) G-05 grade-a sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

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

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Dec 16, 2022
code423n4 added a commit that referenced this issue Dec 16, 2022
code423n4 added a commit that referenced this issue Dec 16, 2022
@GalloDaSballo
Copy link

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-Staff added a commit that referenced this issue Jan 6, 2023
@c4-sponsor c4-sponsor added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Jan 9, 2023
@c4-sponsor
Copy link

GainsGoblin marked the issue as sponsor confirmed

@GalloDaSballo
Copy link

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
Copy link
Contributor

GalloDaSballo marked the issue as grade-a

@C4-Staff C4-Staff added the G-05 label Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization) G-05 grade-a sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

5 participants