-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Summary
The batchCreateHats
function loops through arrays of potentially large sizes. If these arrays become too huge, the transaction may fail due to a lack of gas.
Vulnerability Detail
Line 183 in fafcfdf
function batchCreateHats( |
The function batchCreateHats
loops through several arrays of potentially large sizes to create hats. This means that for each hat
creation, a certain amount of gas is required. If the arrays are too large, there is a risk of running out of gas and the transaction failing. This could happen because the amount of gas specified by the user may not be enough to cover the gas costs of creating all the hats.
Impact
The function will consume more gas than expected, resulting in an out-of-gas error and transaction failure.
Code Snippet
for (uint256 i = 0; i < length;) {
createHat(
_admins[i],
_details[i],
_maxSupplies[i],
_eligibilityModules[i],
_toggleModules[i],
_mutables[i],
_imageURIs[i]
);
unchecked {
++i;
}
}
success = true;
Tool used
Manual Review
Recommendation
Properly estimate the gas costs of creating the hats and to ensure that the gas limit specified by the user is sufficient. We can also split the creation of the hats into smaller batches to reduce the amount of gas used for each batch.