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

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

Gas Optimizations #247

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

Require Statements with Multiple Checks Need More Gas than Multiple Require Statements.

See link for a detailed discussion.
code-423n4/2022-01-xdefi-findings#128


require(
callersLength == _targets.length &&
callersLength == _functionSigs.length &&
callersLength == _enables.length,
"yw"
); // The size of arrays should be equal
https://github.com/code-423n4/2022-10-zksync/tree/main/ethereum/contracts/common/AllowList.sol#L96-L101

require(version == 1 && _bytecodeHash[1] == bytes1(0), "zf"); // Incorrectly formatted bytecodeHash
https://github.com/code-423n4/2022-10-zksync/tree/main/ethereum/contracts/common/L2ContractHelper.sol#L65

@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 c4-judge added unsatisfactory does not satisfy C4 submission criteria; not eligible for awards grade-c labels Nov 16, 2022
@c4-judge
Copy link
Contributor

GalloDaSballo marked the issue as grade-c

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