code-423n4 / 2022-02-nested-findings

0 stars 0 forks source link

QA Report #49

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Long revert string

https://github.com/code-423n4/2022-02-nested/blob/fe6f9ef7783c3c84798c8ab5fc58085a55cebcfc/contracts/NestedFactory.sol#L444

            require(amounts[1] <= _amountToSpend, "NestedFactory::_safeSubmitOrder: Overspent");

https://github.com/code-423n4/2022-02-nested/blob/fe6f9ef7783c3c84798c8ab5fc58085a55cebcfc/contracts/operators/ZeroEx/ZeroExOperator.sol#L36

        require(amountBought != 0, "ZeroExOperator::performSwap: amountBought cant be zero");
        require(amountSold != 0, "ZeroExOperator::performSwap: amountSold cant be zero");

Use uint256 instead of bool

Use uint(1) instead of bool(true) to save gas by avoiding masking ops https://github.com/code-423n4/2022-02-nested/blob/fe6f9ef7783c3c84798c8ab5fc58085a55cebcfc/contracts/abstracts/OwnableFactoryHandler.sol#L17

    mapping(address => bool) public supportedFactories;

Use custom errors

Solidity ^0.8.4 allow the use of custom errors to optimize gas usage. https://blog.soliditylang.org/2021/04/21/custom-errors/

maximebrugel commented 2 years ago

"Long revert string" (Confirmed)

Will be fixed by #70 for ZeroExOperator

"Use uint256 instead of bool" (Acknowledged)

Better for readability.

"Use custom errors" (Disputed)

Is that an issue?

harleythedogC4 commented 2 years ago

This is a gas report, and #48 is identical. I will close this one.