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

Closed
code423n4 opened this issue Nov 9, 2022 · 1 comment
Closed

Gas Optimizations #249

code423n4 opened this issue Nov 9, 2022 · 1 comment
Labels
bug Something isn't working G (Gas Optimization) grade-c unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@code423n4
Copy link
Contributor

code423n4 commented Nov 9, 2022

Title: Using multiple require instead && can save gas

Proof of Concept:
AllowList.sol#L96-L101

Recommended Mitigation Steps:
Change to:

        require(callersLength == _targets.length, "yw");
        require(callersLength == _functionSigs.length, "yw");
        require(callersLength == _enables.length, "yw");

Title: Expression for constant values such as a call to keccak256(), should use immutable rather than constant

Proof of Concept:
L2ContractHelper.sol#L24

Recommended Mitigation Steps:
Change from constant to immutable
reference: here


Title: Using != in require statement is more gas efficient

Proof of Concept:
L1ERC20Bridge.sol#L117
L1ERC20Bridge.sol#L210

Recommended Mitigation Steps:
Change > 0 to != 0


@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Nov 9, 2022
code423n4 added a commit that referenced this issue Nov 9, 2022
code423n4 added a commit that referenced this issue Nov 9, 2022
@c4-judge
Copy link
Contributor

GalloDaSballo marked the issue as grade-c

@c4-judge c4-judge added unsatisfactory does not satisfy C4 submission criteria; not eligible for awards grade-c labels Nov 16, 2022
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) grade-c unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants