code-423n4 / 2024-01-salty-findings

4 stars 3 forks source link

Gas Optimizations #1031

Open c4-bot-8 opened 5 months ago

c4-bot-8 commented 5 months ago

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

c4-judge commented 5 months ago

Picodes marked the issue as grade-b

thenua3bhai commented 4 months ago

Hi @Picodes Thanks for judging I ask you to please re-evalutae this gas report since in my opinion this report should be grade-a as comparing with other grade-a reports.

Since this report contains 14 unique findings out of 16 which were not in bot reports. This report mostly includes good findings. It contains only 2 findings(G-09, G-16) which were in bot report but their instances covered here completely different which were missed by bot. Since they were major gas savings and can be implemented safely so I included them here.

Some major gas findings I want to highlight which were unique ,saves lot of gas all the time and can be implemented safely. They covers most of their available instances from codebase.

G-01 related to function refactoring saves 2 external function calls. G-02 Related to state var. packing into fewer slots saves 15 storage slots. G-04 Alternative approach to check empty string. G-05 Using existed immutable instead of external call. G-06 Making var. immutable since set only once by function. G-07 Cache external call avoid re-calling G-08 Remove unnecessary nonReentrant modifier when no chance of re-entrancy. G-09 Avoid re-calling own functions in same contract by caching the result.

And other findings also safe to implement. You can check all findings in report.

And one bot finding but instances missed by bot. Included this due to it's major gas savings.

G-16 Use storage instead of memory for arrays/structs.

Based on these highlighted findings and others from report. These all are good gas savers and can be implemented 100% safely at no security risk and no protocol logic risk. So I think grade-b is not justified comparing with other grade-a report this should be also grade-a.

Thanks.

c4-judge commented 4 months ago

Picodes marked the issue as grade-a