Gas Optimization for revert code lines to require code lines
There are many revert operations with solady ownable file in codebase which consumes 2300 gas which can be changed with require statement diminishing gas usage without having any effect on the code.
Vulnerability Detail
For example:
if (_strategy == address(0)) revert ZERO_ADDRESS(); can be changed with require(_strategy != address(0), "ZERO_ADDRESS");
if (_isCloneableStrategy(_strategy)) revert IS_APPROVED_STRATEGY(); can be changed with require(!isCloneableStrategy(_strategy),IS_APPROVED_STRATEGY)
if (poolIdLength != _data.length) revert MISMATCH(); with require(poolIdLength == _data.length, "Mismatch in pool ID length");
if (poolIdLength != _data.length) revert MISMATCH(); with require(poolIdLength == _data.length, "Mismatch in pool ID length");
Impact
Using revert statements and calling functions will consume unreasonably overpriced gas fees than using require statements.
This Gas Optimization Issues are in multiple files with same pattern. Use require statements where there is no necessity of revert statements by calling functions to reduce Gas Optimization
Hash01011122
false
Gas Optimization for revert code lines to require code lines
There are many revert operations with solady ownable file in codebase which consumes 2300 gas which can be changed with require statement diminishing gas usage without having any effect on the code.
Vulnerability Detail
For example:
if (_strategy == address(0)) revert ZERO_ADDRESS();
can be changed withrequire(_strategy != address(0), "ZERO_ADDRESS");
if (_isCloneableStrategy(_strategy)) revert IS_APPROVED_STRATEGY();
can be changed withrequire(!isCloneableStrategy(_strategy),IS_APPROVED_STRATEGY)
if (poolIdLength != _data.length) revert MISMATCH();
withrequire(poolIdLength == _data.length, "Mismatch in pool ID length");
if (poolIdLength != _data.length) revert MISMATCH();
withrequire(poolIdLength == _data.length, "Mismatch in pool ID length");
Impact
Using revert statements and calling functions will consume unreasonably overpriced gas fees than using require statements.
Code Snippet
https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/core/Allo.sol#L154 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/core/Allo.sol#L157 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/core/Allo.sol#L183C7-L185C10 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/core/Allo.sol#L242 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/core/Allo.sol#L265 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/core/Allo.sol#L321 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/core/Allo.sol#L341 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/core/Anchor.sol#L72 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/core/Anchor.sol#L75 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/core/Anchor.sol#L81
Tool used
Manual Review
Recommendation
This Gas Optimization Issues are in multiple files with same pattern. Use require statements where there is no necessity of revert statements by calling functions to reduce Gas Optimization