sherlock-audit / 2023-09-Gitcoin-judging

11 stars 7 forks source link

Hash01011122 - Use `++i` instead of `i++` to save gas #864

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

Hash01011122

false

Use ++i instead of i++ to save gas

In some code lines developer is using i++ instead of ++i. This will increase gas amount further.

Vulnerability Detail

Gas Optimization/Informational issue

Impact

Increase in Gas amount further.

Code Snippet

https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/strategies/BaseStrategy.sol#L224 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/strategies/donation-voting-merkle-base/DonationVotingMerkleDistributionBaseStrategy.sol#L300 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/strategies/donation-voting-merkle-base/DonationVotingMerkleDistributionBaseStrategy.sol#L357 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/strategies/donation-voting-merkle-base/DonationVotingMerkleDistributionBaseStrategy.sol#L627 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/strategies/donation-voting-merkle-distribution-vault/DonationVotingMerkleDistributionVaultStrategy.sol#L95 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/strategies/rfp-simple/RFPSimpleStrategy.sol#L239 https://github.com/sherlock-audit/2023-09-Gitcoin/blob/main/allo-v2/contracts/strategies/BaseStrategy.sol#L224

Tool used

Manual Review

Recommendation

Use ++i instead of i++ to save gas.