53070 sc high validator commission update during max allowed commission change causes incorrect reward calculations
Description
Brief / Intro
function setMaxAllowedValidatorCommission(
uint256 newMaxRate
) external onlyRole(PlumeRoles.TIMELOCK_ROLE) {
PlumeStakingStorage.Layout storage $ = PlumeStakingStorage.layout();
// Max rate cannot be more than 50% (REWARD_PRECISION / 2)
if (newMaxRate > PlumeStakingStorage.REWARD_PRECISION / 2) {
revert InvalidMaxCommissionRate(newMaxRate, PlumeStakingStorage.REWARD_PRECISION / 2);
}
uint256 oldMaxRate = $.maxAllowedValidatorCommission;
$.maxAllowedValidatorCommission = newMaxRate;
emit MaxAllowedValidatorCommissionSet(oldMaxRate, newMaxRate);
// Enforce the new max commission on all existing validators
uint16[] memory validatorIds = $.validatorIds;
for (uint256 i = 0; i < validatorIds.length; i++) {
uint16 validatorId = validatorIds[i];
PlumeStakingStorage.ValidatorInfo storage validator = $.validators[validatorId];
if (validator.commission > newMaxRate) {
uint256 oldCommission = validator.commission;
// Settle commissions accrued with the old rate up to this point.
@> PlumeRewardLogic._settleCommissionForValidatorUpToNow($, validatorId);
// Update the validator's commission rate to the new max rate.
@> validator.commission = newMaxRate;
// Create a checkpoint for the new commission rate.
PlumeRewardLogic.createCommissionRateCheckpoint($, validatorId, newMaxRate);
emit ValidatorCommissionSet(validatorId, oldCommission, newMaxRate);
}
}
}Vulnerability Details
Impact Details
Proof of Concept
References / Affected Code
Previous53071 sc insight okxhelper function incompatible with the uniswap v3 swap to with permit selector Next53069 sc low dynamic cooldown interval changes cause unexpected fund lockup extensions
Was this helpful?