he Batch
contract at abstracts/Batch.sol:18
uses a delegatecall
operation in a loop within the batch
function. delegatecall
is a gas-intensive operation, and optimizations are recommended. Additionally, using unchecked arithmetic in the loop’s indexing can prevent unnecessary gas usage by bypassing Solidity’s default overflow checks on uint256
.
This is a Low & Informational level finding. The looping over calls and use of delegatecall
for each invocation incurs a high gas cost, and the contract can reduce this cost by using unchecked
blocks for the loop index. Solidity’s default safety checks on uint256
increments, while protective, are unnecessary here, as the index will not overflow given the constraints of the function.
Implementing these gas-saving measures can reduce the contract’s gas consumption, which becomes particularly significant when batch
is used with a large number of calls. This optimization does not alter functionality or security but enhances the contract’s efficiency.
Manual Review
Add Unchecked Arithmetic: Wrap the loop’s incrementing line (i++
) within an unchecked
block. Since i
will not exceed count
, using unchecked
will save on gas costs by avoiding redundant overflow checks.
By implementing unchecked
on the loop index increment, the contract can achieve improved gas efficiency without compromising on correctness or security.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.