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

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

Gas Optimizations #24

code423n4 opened this issue Feb 22, 2023 · 3 comments
Labels

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 Feb 22, 2023
code423n4 added a commit that referenced this issue Feb 22, 2023
code423n4 added a commit that referenced this issue Feb 22, 2023
@GalloDaSballo
Copy link

| GAS-1 | Use assembly to check for address(0) | 36 |
Marginal

| GAS-2 | Using bools for storage incurs overhead | 2 |
Marginal as it's not used often

| GAS-3 | Cache array length outside of loop | 3 |
| GAS-4 | State variables should be cached in stack variables rather than re-reading them from storage | 3 |
200 (100 from _riskCategory and 100 from _KUMAAddressProvider)

| GAS-5 | Use calldata instead of memory for function arguments that do not get mutated | 13 |
Valid for cBonds let's say 150 each * 2
300

| GAS-6 | Functions guaranteed to revert when called by normal users can be marked payable | 31 |
| GAS-7 | ++i costs less gas than i++, especially when it's used in for-loops (--i/i-- too) | 3 |
Let's say 100

| GAS-8 | Using private rather than public for constants, saves gas | 5 |
| GAS-9 | Use != 0 instead of > 0 for unsigned integer comparison | 11 |
Invalid after 0.8.13

Around 600 gas, report is generic but advice is good

@c4-judge
Copy link
Contributor

GalloDaSballo marked the issue as grade-b

@GalloDaSballo
Copy link

Am going to award B for submitting acceptable advice, however, long-term I believe we want to see more nuanced and high impact reports such as the winning one

@C4-Staff C4-Staff added the G-01 label Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants