You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
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
hats-protocol/src/Hats.sol
Line 183 in fafcfdf
The function
batchCreateHats
loops through several arrays of potentially large sizes to create hats. This means that for eachhat
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
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.
The text was updated successfully, but these errors were encountered: