The function BatchRequests.sendWithdrawalRequests allows calling the sendWithdrawalRequests function on all of the Yieldy contracts at once. However, due to the unbounded for loop, if many Yieldy contracts are added to contracts, this function can potentially DoS due to reaching the block gas limit.
BatchRequests.sendWithdrawalRequests
function sendWithdrawalRequests() external {
uint256 contractsLength = contracts.length;
for (uint256 i; i < contractsLength; ) {
if (
contracts[i] != address(0) &&
IStaking(contracts[i]).canBatchTransactions()
) {
IStaking(contracts[i]).sendWithdrawalRequests();
}
unchecked {
++i;
}
}
}
Manual review
Add offset and limit function parameters to implement a βpaginatedβ for loop.
The text was updated successfully, but these errors were encountered:
All reactions