Skip to content

Latest commit

 

History

History
57 lines (56 loc) · 2.42 KB

delfin454000-G.md

File metadata and controls

57 lines (56 loc) · 2.42 KB

Avoid use of '&&' within a require function

Splitting into separate require() statements saves gas


AllowList.sol: L96-101

        require(
            callersLength == _targets.length &&
                callersLength == _functionSigs.length &&
                callersLength == _enables.length,
            "yw"
        ); // The size of arrays should be equal

Recommendation:

        require(callersLength == _targets.length, "yw");
        require(callersLength == _functionSigs.length, "yw");
        require(callersLength == _enables.length,"yw");
        // The size of arrays should be equal

L2ContractHelper.sol: L65

        require(version == 1 && _bytecodeHash[1] == bytes1(0), "zf"); // Incorrectly formatted bytecodeHash

Recommendation:

        require(version == 1, "zf");
        require(_bytecodeHash[1] == bytes1(0),"zf");
        // Incorrectly formatted bytecodeHash


Avoid use of default "checked" behavior in a for loop

Underflow/overflow checks are made every time ++i (or equivalent counter) is called. Such checks are unnecessary since i is already limited. Therefore, use unchecked {++i} instead


Diamond.sol: L94

        for (uint256 i = 0; i < facetCutsLength; ++i) {

Diamond.sol: L132

        for (uint256 i = 0; i < selectorsLength; ++i) {

Diamond.sol: L153

        for (uint256 i = 0; i < selectorsLength; ++i) {

Diamond.sol: L173

        for (uint256 i = 0; i < selectorsLength; ++i) {