49639 sc insight gas inefficiency in loop storage reads processmaturedcooldowns
Impacts
Description
// File: contracts-src/facets/StakingFacet.sol:854-871
for (uint256 i = 0; i < userAssociatedValidators.length; i++) {
uint16 validatorId = userAssociatedValidators[i];
PlumeStakingStorage.CooldownEntry memory cooldownEntry = $.userValidatorCooldowns[user][validatorId];
// ... multiple storage reads follow
if ($.userValidatorStakes[user][validatorId].staked == 0) {
// ... more storage access
}
}Proof of Concept
Previous50922 sc low unstaking partially will extend the cooldown time for previously unstaked amount tooNext51653 sc high permanent loss of staker rewards after slashing when validator records are cleared
Was this helpful?