sherlock-audit / 2023-09-Gitcoin-judging

11 stars 7 forks source link

Hash01011122 - Gas Optimization for revert code lines to require code lines #843

Closed sherlock-admin2 closed 1 year ago

sherlock-admin2 commented 1 year ago

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:

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