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 #281

Open
code423n4 opened this issue May 22, 2023 · 3 comments
Open

Gas Optimizations #281

code423n4 opened this issue May 22, 2023 · 3 comments
Labels
bug Something isn't working G (Gas Optimization) G-01 grade-a high quality report This report is of especially high quality

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 May 22, 2023
code423n4 added a commit that referenced this issue May 22, 2023
code423n4 added a commit that referenced this issue May 22, 2023
@c4-pre-sort
Copy link

dmvt marked the issue as high quality report

@c4-pre-sort c4-pre-sort added the high quality report This report is of especially high quality label May 25, 2023
@c4-judge
Copy link

c4-judge commented Jun 2, 2023

dmvt marked the issue as grade-a

@drgorillamd
Copy link

drgorillamd commented Jun 7, 2023

Thanks for the report!
Some comments:

reservedToken should be set after the transfer is made so you can save gas if the transfer reverts

this is the transfer of the project token received from the swap, this one should never revert

abi.encodePacked() is cheaper than abi.encode()

not here, compared and exact same cost (with 200 runs) - this might be true with multiple data tho (packed vs unpacked then), with the collision risk it introduces

Optimize names to save gas

Every function of the datasource/delegate will be called once per tx (ie A-B-C has same cost if reordering to C-B-A here

@C4-Staff C4-Staff added the G-01 label Jun 8, 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-01 grade-a high quality report This report is of especially high quality
Projects
None yet
Development

No branches or pull requests

5 participants