59288 sc insight repeated array access in rescuewithdrawfromblocklisted loop causes unnecessary gas consumption
Description
Brief/Intro
Vulnerability Details
for (uint256 i = 0; i < len; i++) {
uint256 _withdrawOf = withdrawSharesOf[periods[i]][from]; // periods[i] accessed
if (isWithdrawClaimed[periods[i]][from]) revert AlreadyClaimedPeriod(periods[i]); // periods[i] accessed twice
if (isWithdrawClaimed[periods[i]][to]) revert AlreadyClaimedPeriod(periods[i]); // periods[i] accessed twice
if (_withdrawOf == 0) revert NoWithdrawalAmount(periods[i]); // periods[i] accessed
withdrawSharesOf[periods[i]][to] += _withdrawOf; // periods[i] accessed
withdrawSharesOf[periods[i]][from] = 0; // periods[i] accessed
isWithdrawClaimed[periods[i]][from] = true; // periods[i] accessed
rescuedShares[i] = _withdrawOf;
}Impact Details
References
Recommendation
Proof of Concept
Proof of Concept
Previous59296 sc low periodattimestamp uint48 timestamp ignores its parameter and always returns the current periodNext59280 sc low periodattimestamp uint48 timestamp ignores timestamp and return incorrect values when it is not time timestamp
Was this helpful?