51979 sc low getaccruedcommission returns outdated accrued commission

  • Submitted on: Aug 6th 2025 at 23:58:13 UTC by @holydevoti0n for Attackathon | Plume Network

  • Report ID: #51979

  • Report Type: Smart Contract

  • Severity: Low

  • Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/facets/ValidatorFacet.sol

Description

Vulnerability Details

To get the total amount of commission accrued per token/validator, the getAccruedCommission function from ValidatorFacet must be called. The issue is that the accrued commission value returned is outdated because the function returns the stored validatorAccruedCommission value without ensuring it is updated up to the current timestamp (updates are only triggered by some other functions like stake/unstake, etc).

Relevant code:

/**
 * @notice Get the amount of commission accrued for a specific token by a validator but not yet claimed.
 * @return The total accrued commission for the specified token.
 */
function getAccruedCommission(uint16 validatorId, address token) public view returns (uint256) {
    PlumeStakingStorage.Layout storage $s = PlumeStakingStorage.layout();
    if (!$s.validatorExists[validatorId]) {
        revert ValidatorDoesNotExist(validatorId);
    }
    if (!$s.isRewardToken[token]) {
        revert TokenDoesNotExist(token);
    }

    return $s.validatorAccruedCommission[validatorId][token];
}

Example scenario: if a validator accrues 10 tokens in commission over 1 hour, getAccruedCommission will only return that 10 tokens if validatorAccruedCommission[validatorId][token] has been updated since the accrual. Since getAccruedCommission does not itself enforce an update, it can return 0 (or another stale value) instead of the true current accrued amount.

Impact Details

getAccruedCommission can return an incorrect (stale) amount because it does not take into account commission accrued up to the current timestamp.

Recommendation

Call updateRewardPerTokenForValidator (or the appropriate updater) before returning the accrued commission so the returned value is up to date.

Suggested change:

Proof of Concept

Add the following test in PlumeStakingDiamond.t.sol:

Run:

Output:


Was this helpful?