Skip to content
Business logic Audit finding Intermediate

Inactive validators are prevented to claim to eligible commission rewards

A validator who requested a commission claim and waited the mandatory one-week timelock cannot finalise the claim if an administrator marks the validator inactive after the timelock has elapsed. This temporarily freezes rewards that were already earned and eligible to be collected.

Plume Network

Originally disclosed on Immunefi

49817 sc medium inactive validators are prevented to claim to eligible commission rewards

Description

Summary

Validators who have initiated the commission claim process via requestCommissionClaim and waited the mandatory one-week period cannot execute finalizeCommissionClaim to withdraw their earned rewards when an administrator changes their status to inactive.

Vulnerability Details

While a validator has an active status and participates in the network, they earn commission rewards. The intended flow is:

{% stepper %} {% step %}

Step: requestCommissionClaim

Validator calls requestCommissionClaim to initiate the commission claim process.

Reference: https://github.com/plumenetwork/contracts/blob/fe67a98fa4344520c5ff2ac9293f5d9601963983/plume/src/facets/ValidatorFacet.sol#L500-L539

Solidity
function requestCommissionClaim(
    uint16 validatorId,
    address token
)
    external
    onlyValidatorAdmin(validatorId)
    nonReentrant
    _validateValidatorExists(validatorId)
    _validateIsToken(token)
{
   ...
    $.pendingCommissionClaims[validatorId][token] = PlumeStakingStorage.PendingCommissionClaim({
        amount: amount,
        requestTimestamp: nowTs,
        token: token,
        recipient: recipient
    });
    $.validatorAccruedCommission[validatorId][token] = 0;
    ...
}

{% endstep %}

{% step %}

Step: waiting period

Wait for the mandatory one-week period to pass:

claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK {% endstep %}

{% step %}

Step: finalizeCommissionClaim

Validator calls finalizeCommissionClaim to withdraw their earned rewards.

Reference: https://github.com/plumenetwork/contracts/blob/fe67a98fa4344520c5ff2ac9293f5d9601963983/plume/src/facets/ValidatorFacet.sol#L573-L575

Solidity
function finalizeCommissionClaim(
    uint16 validatorId,
    address token
) external onlyValidatorAdmin(validatorId) nonReentrant returns (uint256) {
    ...
    uint256 readyTimestamp = claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK;

    // First, check if the timelock has passed from the perspective of the current block.
    if (block.timestamp < readyTimestamp) {
        revert ClaimNotReady(validatorId, token, readyTimestamp);
    }

    // --- REVISED SLASHING CHECK ---
    // If the validator is slashed, the claim is only considered valid if its timelock was
    // fully completed BEFORE the slash occurred. This invalidates any pending claims.
    if (validator.slashed && readyTimestamp >= validator.slashedAtTimestamp) {
        revert ValidatorInactive(validatorId);
    }

    // For a non-slashed validator, simply require it to be active to finalize a claim.
    if (!validator.slashed && !validator.active) {
        revert ValidatorInactive(validatorId);
    }
    ...
}

{% endstep %} {% endstepper %}

The problem: Even if the validator was eligible to finalize the claim after the waiting period, if an admin sets the validator to inactive after the claim became eligible, finalizeCommissionClaim will revert with ValidatorInactive. This prevents the validator from withdrawing funds that were accrued while active and whose claim became eligible before the status change.

This is inconsistent with other behaviors in the codebase (e.g., users can unstake and withdraw from inactive validators and can collect rewards/funds from slashed validators if those funds were in a parked state eligible to be claimed before the slash).

Impact

Any validator that made a commission claim and became eligible to collect it before being set to inactive can be prevented from collecting those rewards. This results in temporary freezing of funds that can only be resolved if the admin re-activates the validator.

Recommendation

Modify finalizeCommissionClaim so it allows finalization when the claim timelock completed before the validator became inactive. Suggested change:

Diff
function finalizeCommissionClaim(
    uint16 validatorId,
    address token
) external onlyValidatorAdmin(validatorId) nonReentrant returns (uint256) {
    ...

    // For a non-slashed validator, simply require it to be active to finalize a claim.
-    if (!validator.slashed && !validator.active) {
-        revert ValidatorInactive(validatorId);
-    }

+    bool validatorCanClaimRewards = (claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK) < validator.slashedAtTimestamp;
+    if (!validator.slashed && !validatorCanClaimRewards) {
+        revert ValidatorInactive(validatorId);
+    }
    ...
}

This ensures a non-slashed validator may finalize a claim if the claim's timelock completed before the validator was marked inactive (or slashed).

Proof of Concept

Context

PoC demonstrates:

{% stepper %} {% step %} Active validator requests commission claim. {% endstep %}

{% step %} Active validator waits the unlock period (7 days) and becomes eligible to claim. {% endstep %}

{% step %} Admin sets the validator to inactive. {% endstep %}

{% step %} Validator tries to claim commission but finalizeCommissionClaim reverts with ValidatorInactive. {% endstep %} {% endstepper %}

PoC (test)

Add the following test in PlumeStakeDiamond.t.sol:

<details> <summary>Show test code (click to expand)</summary>
Solidity
function testValidatorCannotClaimEligibleCommission_whenSetToInactive() public {
        // Set a very specific reward rate for predictable results
        uint256 rewardRate = 1e18; // 1 PUSD per second
        vm.startPrank(admin);
        address[] memory tokens = new address[](1);
        tokens[0] = address(pUSD);
        uint256[] memory rates = new uint256[](1);
        rates[0] = rewardRate;
        RewardsFacet(address(diamondProxy)).setRewardRates(tokens, rates);

        // Make sure treasury is properly set
        RewardsFacet(address(diamondProxy)).setTreasury(address(treasury));

        // Ensure treasury has enough PUSD by transferring tokens
        uint256 treasuryAmount = 100 ether;
        pUSD.transfer(address(treasury), treasuryAmount);
        vm.stopPrank();

        // Set a 10% commission rate for the validator
        vm.startPrank(validatorAdmin);
        uint256 newCommission = 10e16;
        ValidatorFacet(address(diamondProxy)).setValidatorCommission(
            DEFAULT_VALIDATOR_ID,
            newCommission
        );
        vm.stopPrank();

        // Create validator with 10% commission
        uint256 initialStake = 10 ether;
        vm.startPrank(user1);
        StakingFacet(address(diamondProxy)).stake{value: initialStake}(
            DEFAULT_VALIDATOR_ID
        );
        vm.stopPrank();

        // Move time forward to accrue rewards
        vm.roll(block.number + 10);
        vm.warp(block.timestamp + 10);

        // Trigger reward updates by having a user interact with the system
        // This will internally call updateRewardsForValidator
        vm.startPrank(user2);
        StakingFacet(address(diamondProxy)).stake{value: 1 ether}(
            DEFAULT_VALIDATOR_ID
        );
        vm.stopPrank();

        // Move time forward again
        vm.roll(block.number + 1);
        vm.warp(block.timestamp + 1);

        // Interact again to update rewards once more
        vm.startPrank(user1);

        // Unstake a minimal amount to trigger reward update
        StakingFacet(address(diamondProxy)).unstake(DEFAULT_VALIDATOR_ID, 1); // Unstake 1 wei
        vm.stopPrank();

        // Check that some commission has accrued (positive amount)
        uint256 commission = ValidatorFacet(address(diamondProxy))
            .getAccruedCommission(DEFAULT_VALIDATOR_ID, address(pUSD));
        assertGt(commission, 0, "Commission should be greater than 0");

        // @audit - validator request commission claim
        vm.startPrank(validatorAdmin);
        uint256 balanceBefore = pUSD.balanceOf(validatorAdmin);

        ValidatorFacet(address(diamondProxy)).requestCommissionClaim(
            DEFAULT_VALIDATOR_ID,
            address(pUSD)
        );
        vm.stopPrank();

        // unlock period passes(7 days), now this validator is eligible to claim commission
        uint256 blockTimestamp = block.timestamp;
        vm.warp(blockTimestamp + 7 days + 1 seconds);

        // but admin makes validator inactive first
        vm.startPrank(admin);
           ValidatorFacet(address(diamondProxy)).setValidatorStatus(
            DEFAULT_VALIDATOR_ID,
            false
        );
        vm.stopPrank();

        // @audit - validator try to finalize commission claim but it reverts with ValidatorInactive error
        vm.startPrank(validatorAdmin);
            vm.expectRevert(
                abi.encodeWithSelector(ValidatorInactive.selector, DEFAULT_VALIDATOR_ID)
            );
            ValidatorFacet(address(diamondProxy)).finalizeCommissionClaim(
                DEFAULT_VALIDATOR_ID,
                address(pUSD)
            );
        vm.stopPrank();
    }
</details>

Run: forge test --mt testValidatorCannotClaimEligibleCommission_whenSetToInactive -vv --via-ir

Output:

[PASS] testValidatorCannotClaimEligibleCommission_whenSetToInactive() (gas: 1598430)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 12.36ms (1.18ms CPU time)
Ran 1 test suite in 182.91ms (12.36ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)

If you want, I can:

  • Propose a minimal patched implementation for finalizeCommissionClaim that accounts for validator inactive transitions (keeping style and existing checks).
  • Create a unit test that validates both scenarios (claim eligible before inactive vs not eligible).

The original report as published on Immunefi. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

Plume Network is a staking system implemented as a diamond proxy with facets. The target of this report is ValidatorFacet.sol, the facet that handles validator commission: validators accrue commission rewards while they are active and participating in the network, and they withdraw those rewards through a two-step process with a mandatory timelock.

The intended flow has three stages:

  1. The validator calls requestCommissionClaim to start the claim. The accrued commission is moved into a pending claim record and the accrued balance is zeroed.
  2. The validator waits for the mandatory one-week period, defined as claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK.
  3. The validator calls finalizeCommissionClaim to withdraw the earned rewards.

The report shows that this flow breaks when an administrator changes the validator's status to inactive after the claim has already become eligible.

Setup

The finding is a smart contract issue, reported as Medium severity, with the impact listed as temporary freezing of funds for at least 24 hours. The affected code is in the Plume Network repository, in plume/src/facets/ValidatorFacet.sol.

The proof of concept is a Foundry test added to PlumeStakeDiamond.t.sol. It uses the following roles and actors:

Actor Role in the test
admin Sets reward rates, sets the treasury, and later sets the validator inactive
validatorAdmin Sets the validator commission and drives the commission claim
user1, user2 Stake and unstake to trigger reward updates
treasury Funded with PUSD so rewards can be paid
pUSD The reward token
DEFAULT_VALIDATOR_ID The validator under test

The test is run with:

Bash
forge test --mt testValidatorCannotClaimEligibleCommission\_whenSetToInactive -vv --via-ir

Finding it

The report notes the behaviour is inconsistent with other parts of the codebase. finalizeCommissionClaim contains two checks. The first rejects a claim from a slashed validator when the claim's ready timestamp is at or after the slash timestamp. The second rejects a claim from a non-slashed validator whenever the validator is not active:

Solidity
function finalizeCommissionClaim(
    uint16 validatorId,
    address token
) external onlyValidatorAdmin(validatorId) nonReentrant returns (uint256) {
    ...
    uint256 readyTimestamp = claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK;

    // First, check if the timelock has passed from the perspective of the current block.
    if (block.timestamp < readyTimestamp) {
        revert ClaimNotReady(validatorId, token, readyTimestamp);
    }

    // --- REVISED SLASHING CHECK ---
    // If the validator is slashed, the claim is only considered valid if its timelock was
    // fully completed BEFORE the slash occurred. This invalidates any pending claims.
    if (validator.slashed && readyTimestamp >= validator.slashedAtTimestamp) {
        revert ValidatorInactive(validatorId);
    }

    // For a non-slashed validator, simply require it to be active to finalize a claim.
    if (!validator.slashed && !validator.active) {
        revert ValidatorInactive(validatorId);
    }
    ...
}

The slashing branch is time-aware: it compares the claim's ready timestamp with the moment of the slash. The inactive branch is not. It only looks at the validator's current status, so a validator whose claim became eligible before the status change is treated the same as one that never earned the right to claim. The researcher considered this inconsistent with other behaviour in the codebase, where users can unstake and withdraw from inactive validators, and can collect rewards and funds from slashed validators when those funds were in a parked state eligible to be claimed before the slash.

Exploitation

Step 1: request the commission claim

The validator starts the claim with requestCommissionClaim, which is restricted to the validator admin, is non-reentrant, and validates that the validator exists and that the token is supported:

Solidity
function requestCommissionClaim(
    uint16 validatorId,
    address token
)
    external
    onlyValidatorAdmin(validatorId)
    nonReentrant
    _validateValidatorExists(validatorId)
    _validateIsToken(token)
{
   ...
    $.pendingCommissionClaims[validatorId][token] = PlumeStakingStorage.PendingCommissionClaim({
        amount: amount,
        requestTimestamp: nowTs,
        token: token,
        recipient: recipient
    });
    $.validatorAccruedCommission[validatorId][token] = 0;
    ...
}

The important effect is that the accrued commission is stored in a pending claim with the current timestamp, and the accrued commission balance is reset to zero.

Step 2: wait out the timelock

The claim becomes eligible once the mandatory one-week period has passed:

Text
claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK

Step 3: finalize the claim

Under normal conditions the validator calls finalizeCommissionClaim and receives the rewards. The function first checks that the timelock has passed, then applies the slashing check and the active check shown above.

Step 4: the status change blocks the claim

If an admin sets the validator to inactive after the claim became eligible, the second check fails because validator.active is false, and the call reverts with ValidatorInactive. The validator cannot withdraw funds that were accrued while active and whose claim became eligible before the status change.

The proof of concept reproduces this in PlumeStakeDiamond.t.sol:

Solidity
function testValidatorCannotClaimEligibleCommission_whenSetToInactive() public {
        // Set a very specific reward rate for predictable results
        uint256 rewardRate = 1e18; // 1 PUSD per second
        vm.startPrank(admin);
        address[] memory tokens = new address[](1);
        tokens[0] = address(pUSD);
        uint256[] memory rates = new uint256[](1);
        rates[0] = rewardRate;
        RewardsFacet(address(diamondProxy)).setRewardRates(tokens, rates);

        // Make sure treasury is properly set
        RewardsFacet(address(diamondProxy)).setTreasury(address(treasury));

        // Ensure treasury has enough PUSD by transferring tokens
        uint256 treasuryAmount = 100 ether;
        pUSD.transfer(address(treasury), treasuryAmount);
        vm.stopPrank();

        // Set a 10% commission rate for the validator
        vm.startPrank(validatorAdmin);
        uint256 newCommission = 10e16;
        ValidatorFacet(address(diamondProxy)).setValidatorCommission(
            DEFAULT_VALIDATOR_ID,
            newCommission
        );
        vm.stopPrank();

        // Create validator with 10% commission
        uint256 initialStake = 10 ether;
        vm.startPrank(user1);
        StakingFacet(address(diamondProxy)).stake{value: initialStake}(
            DEFAULT_VALIDATOR_ID
        );
        vm.stopPrank();

        // Move time forward to accrue rewards
        vm.roll(block.number + 10);
        vm.warp(block.timestamp + 10);

        // Trigger reward updates by having a user interact with the system
        // This will internally call updateRewardsForValidator
        vm.startPrank(user2);
        StakingFacet(address(diamondProxy)).stake{value: 1 ether}(
            DEFAULT_VALIDATOR_ID
        );
        vm.stopPrank();

        // Move time forward again
        vm.roll(block.number + 1);
        vm.warp(block.timestamp + 1);

        // Interact again to update rewards once more
        vm.startPrank(user1);

        // Unstake a minimal amount to trigger reward update
        StakingFacet(address(diamondProxy)).unstake(DEFAULT_VALIDATOR_ID, 1); // Unstake 1 wei
        vm.stopPrank();

        // Check that some commission has accrued (positive amount)
        uint256 commission = ValidatorFacet(address(diamondProxy))
            .getAccruedCommission(DEFAULT_VALIDATOR_ID, address(pUSD));
        assertGt(commission, 0, "Commission should be greater than 0");

        // @audit - validator request commission claim
        vm.startPrank(validatorAdmin);
        uint256 balanceBefore = pUSD.balanceOf(validatorAdmin);

        ValidatorFacet(address(diamondProxy)).requestCommissionClaim(
            DEFAULT_VALIDATOR_ID,
            address(pUSD)
        );
        vm.stopPrank();

        // unlock period passes(7 days), now this validator is eligible to claim commission
        uint256 blockTimestamp = block.timestamp;
        vm.warp(blockTimestamp + 7 days + 1 seconds);

        // but admin makes validator inactive first
        vm.startPrank(admin);
           ValidatorFacet(address(diamondProxy)).setValidatorStatus(
            DEFAULT_VALIDATOR_ID,
            false
        );
        vm.stopPrank();

        // @audit - validator try to finalize commission claim but it reverts with ValidatorInactive error
        vm.startPrank(validatorAdmin);
            vm.expectRevert(
                abi.encodeWithSelector(ValidatorInactive.selector, DEFAULT_VALIDATOR_ID)
            );
            ValidatorFacet(address(diamondProxy)).finalizeCommissionClaim(
                DEFAULT_VALIDATOR_ID,
                address(pUSD)
            );
        vm.stopPrank();
    }

The test sets a reward rate of 1e18 per second, funds the treasury with 100 ether of PUSD, sets a 10% commission, stakes 10 ether from user1, advances time, and triggers reward updates with a 1 ether stake from user2 and a 1 wei unstake from user1. It asserts that accrued commission is greater than zero, requests the claim as validatorAdmin, warps 7 days + 1 seconds past the request, sets the validator inactive as admin, and then expects finalizeCommissionClaim to revert with ValidatorInactive for DEFAULT_VALIDATOR_ID.

The test passes:

Text
[PASS] testValidatorCannotClaimEligibleCommission_whenSetToInactive() (gas: 1598430)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 12.36ms (1.18ms CPU time)
Ran 1 test suite in 182.91ms (12.36ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)

Root cause

The active check in finalizeCommissionClaim is unconditional for non-slashed validators. It does not compare the claim's ready timestamp with the moment the validator became inactive, unlike the slashing branch, which compares readyTimestamp with validator.slashedAtTimestamp. As a result, a claim that was already eligible is invalidated by a later status change. The existing timelock check does not help, because it only confirms that the waiting period has passed; it says nothing about the validator's status at the time the claim became eligible.

Impact

Any validator that requested a commission claim and became eligible to collect it before being set to inactive is prevented from collecting those rewards. The funds are temporarily frozen and can only be released if the admin re-activates the validator. The report classifies this as temporary freezing of funds for at least 24 hours.

Fix

The recommendation is to modify finalizeCommissionClaim so that it allows finalisation when the claim timelock completed before the validator became inactive. The suggested change is:

Diff
function finalizeCommissionClaim(
    uint16 validatorId,
    address token
) external onlyValidatorAdmin(validatorId) nonReentrant returns (uint256) {
    ...

    // For a non-slashed validator, simply require it to be active to finalize a claim.
-    if (!validator.slashed && !validator.active) {
-        revert ValidatorInactive(validatorId);
-    }

+    bool validatorCanClaimRewards = (claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK) < validator.slashedAtTimestamp;
+    if (!validator.slashed && !validatorCanClaimRewards) {
+        revert ValidatorInactive(validatorId);
+    }
    ...
}

This ensures a non-slashed validator may finalize a claim if the claim's timelock completed before the validator was marked inactive or slashed.

Variants to test

  1. Apply the same pattern to other two-step withdrawal flows with a timelock, such as unstaking queues or reward claims. A positive result is a finalisation function that checks only the current status and ignores when the claim became eligible.
  2. Compare the slashing branch and the inactive branch of every status-dependent function. A positive result is one branch that compares timestamps and another that does not.
  3. Test status changes that happen exactly at the boundary: a claim that becomes eligible in the same block as the status change, and one that becomes eligible one second before. A positive result is a revert for a claim that was already eligible.
  4. Check whether re-activating a validator restores the pending claim, and whether the claim can still be finalised after re-activation. A positive result is a claim that survives the round trip, which confirms the freeze is temporary rather than permanent.

Hunting notes

This kind of bug tends to hide in finalisation functions that mix a time-based eligibility check with a live status check. During recon, look for functions that revert with an "inactive" or "not active" error and check whether the revert condition uses a stored timestamp or only the current state. The signal is an asymmetry: one branch of the same function compares timestamps, the other does not.

The researcher showed impact with a Foundry test that walks the full lifecycle: accrual, claim request, timelock expiry, status change, and the revert. The test asserts that commission accrued before the claim and uses vm.expectRevert with the ValidatorInactive selector.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 19 min read.

What happened, in plain words

Plume Network is a system where people lock up digital money (called "staking") and, in return, earn rewards. Some participants, called validators, run the network and earn a cut of those rewards, called a commission. The report is about a bug in the code that pays out that commission.

A validator who wants their commission has to do it in two steps. First they ask for it, then they wait a mandatory one week, and then they collect it. The bug is this: if an administrator marks the validator as "inactive" after the one week has passed but before the validator has collected, the collection step fails. The validator's money is stuck. It is not lost forever, but it cannot be taken out until an administrator switches the validator back to active.

The report rates this as Medium severity, with the impact described as temporary freezing of funds for at least 24 hours. The affected code is in a file called ValidatorFacet.sol in the Plume Network repository.

A few words you will meet throughout, explained from zero:

  • Smart contract: a program that lives on a blockchain. It runs exactly as written, and nobody can change its behaviour after it is deployed. Think of a vending machine: you put money in, it follows its rules, and no shop assistant can bend those rules on the spot.
  • Blockchain: a shared record book that many computers keep copies of. Once something is written, it is very hard to change.
  • Staking: locking your money into the system for a while, in exchange for rewards. Like putting money in a savings account with a fixed term.
  • Validator: a participant who helps run the network and earns a commission on the rewards generated by the money staked through them.
  • Commission: the validator's cut of the rewards. It is the money at the centre of this report.
  • Timelock: a built-in waiting period. The system refuses to do something until a set amount of time has passed. Like a bank telling you a fixed deposit matures in seven days.
  • Revert: when a smart contract refuses to do what was asked and cancels the whole operation. It is the blockchain equivalent of a cash machine showing an error and giving your card back.
  • Admin: an account with special powers, in this case the power to switch a validator's status between active and inactive.
  • Foundry: a toolkit for writing and running tests against smart contracts. A test is a small program that sets up a situation and checks the result.

Context

Plume Network's staking code is organised as a "diamond proxy with facets". That sounds complicated, but the idea is simple. A diamond proxy is one main contract that forwards requests to smaller contracts, called facets, each handling one area. Think of a large office building with one reception desk: you tell reception what you need, and they send you to the right department. Here, the department relevant to this report is ValidatorFacet.sol, which handles validator commission.

Validators earn commission while they are active and taking part in the network. To take the money out, they go through a two-step process with a mandatory waiting period. The intended flow has three stages:

  1. The validator calls requestCommissionClaim to start the claim. The commission earned so far is moved into a "pending claim" record, and the running total of earned commission is set back to zero.
  2. The validator waits for the mandatory one-week period, defined as claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK.
  3. The validator calls finalizeCommissionClaim to actually receive the rewards.

The report shows that this flow breaks when an administrator changes the validator's status to inactive after the claim has already become eligible.

Setup

The finding is a smart contract issue, reported as Medium severity, with the impact listed as temporary freezing of funds for at least 24 hours. The affected code is in the Plume Network repository, in plume/src/facets/ValidatorFacet.sol.

The proof of concept is a Foundry test added to a test file called PlumeStakeDiamond.t.sol. A proof of concept is a small demonstration that shows the bug really happens, rather than just describing it. The test uses the following roles and actors:

Actor Role in the test
admin Sets reward rates, sets the treasury, and later sets the validator inactive
validatorAdmin Sets the validator commission and drives the commission claim
user1, user2 Stake and unstake to trigger reward updates
treasury Funded with PUSD so rewards can be paid
pUSD The reward token
DEFAULT_VALIDATOR_ID The validator under test

A "token" here is a digital currency issued on the blockchain. PUSD is the one used for rewards in this test. A "treasury" is the pot of money the system pays rewards from.

The test is run with this command:

Bash
forge test --mt testValidatorCannotClaimEligibleCommission\_whenSetToInactive -vv --via-ir

Line by line:

  • forge is the Foundry command-line tool.
  • test tells it to run tests.
  • --mt means "match test": run only the test whose name matches what follows.
  • testValidatorCannotClaimEligibleCommission\_whenSetToInactive is the name of the test. The backslash before the underscore is an escaping detail for the command line.
  • -vv asks for more detailed output.
  • --via-ir tells the compiler to use a particular compilation pipeline. It is a technical setting; you do not need to understand it to follow the story.

Finding it

The report notes the behaviour is inconsistent with other parts of the codebase. finalizeCommissionClaim contains two checks. The first rejects a claim from a slashed validator when the claim's ready timestamp is at or after the slash timestamp. The second rejects a claim from a non-slashed validator whenever the validator is not active:

Solidity
function finalizeCommissionClaim(
    uint16 validatorId,
    address token
) external onlyValidatorAdmin(validatorId) nonReentrant returns (uint256) {
    ...
    uint256 readyTimestamp = claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK;

    // First, check if the timelock has passed from the perspective of the current block.
    if (block.timestamp < readyTimestamp) {
        revert ClaimNotReady(validatorId, token, readyTimestamp);
    }

    // --- REVISED SLASHING CHECK ---
    // If the validator is slashed, the claim is only considered valid if its timelock was
    // fully completed BEFORE the slash occurred. This invalidates any pending claims.
    if (validator.slashed && readyTimestamp >= validator.slashedAtTimestamp) {
        revert ValidatorInactive(validatorId);
    }

    // For a non-slashed validator, simply require it to be active to finalize a claim.
    if (!validator.slashed && !validator.active) {
        revert ValidatorInactive(validatorId);
    }
    ...
}

Line by line, in plain words:

  • function finalizeCommissionClaim( starts the definition of the function that pays out a commission claim.
  • uint16 validatorId, is the first input: the number identifying which validator is claiming. uint16 means a whole number that fits in 16 bits.
  • address token is the second input: the address of the token being claimed. An "address" is a blockchain account identifier, like an account number.
  • ) external onlyValidatorAdmin(validatorId) nonReentrant returns (uint256) { adds conditions and outputs. external means anyone can call it from outside. onlyValidatorAdmin(validatorId) means only the validator's admin account may call it. nonReentrant blocks a known attack pattern where a contract calls back into itself mid-operation. returns (uint256) says it hands back a number.
  • uint256 readyTimestamp = claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK; works out the moment the claim becomes collectable: the time the claim was requested, plus the fixed waiting period.
  • if (block.timestamp < readyTimestamp) { checks whether the current time is still before that moment. block.timestamp is the current time as the blockchain sees it.
  • revert ClaimNotReady(validatorId, token, readyTimestamp); if so, the whole call is cancelled with an error saying the claim is not ready yet.
  • The comment lines starting with // are notes for humans and do nothing.
  • if (validator.slashed && readyTimestamp >= validator.slashedAtTimestamp) { is the first real check. "Slashed" means punished: some of a validator's staked money was taken away for misbehaviour. This line says: if the validator was slashed, and the claim became ready at or after the moment of the slash, then...
  • revert ValidatorInactive(validatorId); ...cancel the call with a ValidatorInactive error.
  • if (!validator.slashed && !validator.active) { is the second check. ! means "not". So: if the validator was not slashed, and the validator is not currently active, then...
  • revert ValidatorInactive(validatorId); ...cancel the call with the same error.

The slashing branch is time-aware: it compares the claim's ready timestamp with the moment of the slash. The inactive branch is not. It only looks at the validator's current status, so a validator whose claim became eligible before the status change is treated the same as one that never earned the right to claim. The researcher considered this inconsistent with other behaviour in the codebase, where users can unstake and withdraw from inactive validators, and can collect rewards and funds from slashed validators when those funds were in a parked state eligible to be claimed before the slash.

Exploitation

Step 1: request the commission claim

The validator starts the claim with requestCommissionClaim, which is restricted to the validator admin, is non-reentrant, and validates that the validator exists and that the token is supported:

Solidity
function requestCommissionClaim(
    uint16 validatorId,
    address token
)
    external
    onlyValidatorAdmin(validatorId)
    nonReentrant
    _validateValidatorExists(validatorId)
    _validateIsToken(token)
{
   ...
    $.pendingCommissionClaims[validatorId][token] = PlumeStakingStorage.PendingCommissionClaim({
        amount: amount,
        requestTimestamp: nowTs,
        token: token,
        recipient: recipient
    });
    $.validatorAccruedCommission[validatorId][token] = 0;
    ...
}

Line by line:

  • function requestCommissionClaim( starts the function that begins a claim.
  • uint16 validatorId, and address token are the two inputs: which validator, and which token.
  • external means it can be called from outside the contract.
  • onlyValidatorAdmin(validatorId) restricts it to the validator's admin account.
  • nonReentrant blocks the re-entry attack pattern mentioned earlier.
  • _validateValidatorExists(validatorId) stops the call if the validator does not exist.
  • _validateIsToken(token) stops the call if the token is not one the system supports.
  • $.pendingCommissionClaims[validatorId][token] = PlumeStakingStorage.PendingCommissionClaim({ creates a record of the pending claim, filed under this validator and this token.
  • amount: amount, stores how much is being claimed.
  • requestTimestamp: nowTs, stores the current time. This is the starting point for the one-week wait.
  • token: token, stores which token it is.
  • recipient: recipient stores who will receive the money.
  • $.validatorAccruedCommission[validatorId][token] = 0; resets the running total of earned commission to zero, because it has now been moved into the pending claim.

The important effect is that the accrued commission is stored in a pending claim with the current timestamp, and the accrued commission balance is reset to zero. Why this step matters: it is the moment the clock starts. Everything that follows depends on the timestamp written here.

Step 2: wait out the timelock

The claim becomes eligible once the mandatory one-week period has passed:

Text
claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK

This is simply the request time plus the fixed waiting period. Why this step matters: eligibility is a fact about time, not about the validator's current status. Once the week has passed, the validator has earned the right to collect.

Step 3: finalize the claim

Under normal conditions the validator calls finalizeCommissionClaim and receives the rewards. The function first checks that the timelock has passed, then applies the slashing check and the active check shown above.

Step 4: the status change blocks the claim

If an admin sets the validator to inactive after the claim became eligible, the second check fails because validator.active is false, and the call reverts with ValidatorInactive. The validator cannot withdraw funds that were accrued while active and whose claim became eligible before the status change.

Why this is a problem: the validator did everything right. They earned the commission while active, they requested the claim, and they waited the full week. A later administrative action then takes away a right they had already earned. The money is not stolen, but it is locked.

The proof of concept reproduces this in PlumeStakeDiamond.t.sol:

Solidity
function testValidatorCannotClaimEligibleCommission_whenSetToInactive() public {
        // Set a very specific reward rate for predictable results
        uint256 rewardRate = 1e18; // 1 PUSD per second
        vm.startPrank(admin);
        address[] memory tokens = new address[](1);
        tokens[0] = address(pUSD);
        uint256[] memory rates = new uint256[](1);
        rates[0] = rewardRate;
        RewardsFacet(address(diamondProxy)).setRewardRates(tokens, rates);

        // Make sure treasury is properly set
        RewardsFacet(address(diamondProxy)).setTreasury(address(treasury));

        // Ensure treasury has enough PUSD by transferring tokens
        uint256 treasuryAmount = 100 ether;
        pUSD.transfer(address(treasury), treasuryAmount);
        vm.stopPrank();

        // Set a 10% commission rate for the validator
        vm.startPrank(validatorAdmin);
        uint256 newCommission = 10e16;
        ValidatorFacet(address(diamondProxy)).setValidatorCommission(
            DEFAULT_VALIDATOR_ID,
            newCommission
        );
        vm.stopPrank();

        // Create validator with 10% commission
        uint256 initialStake = 10 ether;
        vm.startPrank(user1);
        StakingFacet(address(diamondProxy)).stake{value: initialStake}(
            DEFAULT_VALIDATOR_ID
        );
        vm.stopPrank();

        // Move time forward to accrue rewards
        vm.roll(block.number + 10);
        vm.warp(block.timestamp + 10);

        // Trigger reward updates by having a user interact with the system
        // This will internally call updateRewardsForValidator
        vm.startPrank(user2);
        StakingFacet(address(diamondProxy)).stake{value: 1 ether}(
            DEFAULT_VALIDATOR_ID
        );
        vm.stopPrank();

        // Move time forward again
        vm.roll(block.number + 1);
        vm.warp(block.timestamp + 1);

        // Interact again to update rewards once more
        vm.startPrank(user1);

        // Unstake a minimal amount to trigger reward update
        StakingFacet(address(diamondProxy)).unstake(DEFAULT_VALIDATOR_ID, 1); // Unstake 1 wei
        vm.stopPrank();

        // Check that some commission has accrued (positive amount)
        uint256 commission = ValidatorFacet(address(diamondProxy))
            .getAccruedCommission(DEFAULT_VALIDATOR_ID, address(pUSD));
        assertGt(commission, 0, "Commission should be greater than 0");

        // @audit - validator request commission claim
        vm.startPrank(validatorAdmin);
        uint256 balanceBefore = pUSD.balanceOf(validatorAdmin);

        ValidatorFacet(address(diamondProxy)).requestCommissionClaim(
            DEFAULT_VALIDATOR_ID,
            address(pUSD)
        );
        vm.stopPrank();

        // unlock period passes(7 days), now this validator is eligible to claim commission
        uint256 blockTimestamp = block.timestamp;
        vm.warp(blockTimestamp + 7 days + 1 seconds);

        // but admin makes validator inactive first
        vm.startPrank(admin);
           ValidatorFacet(address(diamondProxy)).setValidatorStatus(
            DEFAULT_VALIDATOR_ID,
            false
        );
        vm.stopPrank();

        // @audit - validator try to finalize commission claim but it reverts with ValidatorInactive error
        vm.startPrank(validatorAdmin);
            vm.expectRevert(
                abi.encodeWithSelector(ValidatorInactive.selector, DEFAULT_VALIDATOR_ID)
            );
            ValidatorFacet(address(diamondProxy)).finalizeCommissionClaim(
                DEFAULT_VALIDATOR_ID,
                address(pUSD)
            );
        vm.stopPrank();
    }

This is a long block, so here is what each part does, in order:

  • function testValidatorCannotClaimEligibleCommission_whenSetToInactive() public { defines the test. The name says what it checks: a validator cannot claim an eligible commission once set to inactive.
  • uint256 rewardRate = 1e18; sets the reward rate. 1e18 is a way of writing a very large number, used because tokens are tracked in tiny units. The comment says it means 1 PUSD per second.
  • vm.startPrank(admin); tells the test framework to act as the admin account from now on. vm is the test helper; a "prank" makes the next calls look like they come from a chosen account.
  • address[] memory tokens = new address[](1); creates a list that can hold one token address.
  • tokens[0] = address(pUSD); puts PUSD in that list.
  • uint256[] memory rates = new uint256[](1); creates a matching list for one rate.
  • rates[0] = rewardRate; puts the rate in it.
  • RewardsFacet(address(diamondProxy)).setRewardRates(tokens, rates); calls the rewards department of the diamond proxy to apply these rates.
  • RewardsFacet(address(diamondProxy)).setTreasury(address(treasury)); tells the system which account is the treasury.
  • uint256 treasuryAmount = 100 ether; sets aside 100 ether worth of PUSD. "ether" here is a unit of amount used in the test, not a different currency.
  • pUSD.transfer(address(treasury), treasuryAmount); moves that amount into the treasury so rewards can actually be paid.
  • vm.stopPrank(); stops acting as admin.
  • vm.startPrank(validatorAdmin); now acts as the validator's admin.
  • uint256 newCommission = 10e16; sets the commission to 10 percent, written in the same large-number style.
  • ValidatorFacet(address(diamondProxy)).setValidatorCommission(DEFAULT_VALIDATOR_ID, newCommission); applies that commission to the validator under test.
  • vm.stopPrank(); stops acting as the validator admin.
  • uint256 initialStake = 10 ether; sets the amount user1 will stake.
  • vm.startPrank(user1); acts as user1.
  • StakingFacet(address(diamondProxy)).stake{value: initialStake}(DEFAULT_VALIDATOR_ID); stakes that amount through the staking department. The {value: ...} part attaches the money to the call.
  • vm.stopPrank(); stops acting as user1.
  • vm.roll(block.number + 10); moves the simulated block number forward by 10. A "block" is a batch of transactions; the number counts them.
  • vm.warp(block.timestamp + 10); moves the simulated clock forward by 10 seconds. warp is the test tool for time travel.
  • vm.startPrank(user2); acts as user2.
  • StakingFacet(address(diamondProxy)).stake{value: 1 ether}(DEFAULT_VALIDATOR_ID); stakes 1 ether. The comment explains why: interacting with the system triggers an internal reward update.
  • vm.stopPrank(); stops acting as user2.
  • vm.roll(block.number + 1); and vm.warp(block.timestamp + 1); move time forward again, by one block and one second.
  • vm.startPrank(user1); acts as user1 again.
  • StakingFacet(address(diamondProxy)).unstake(DEFAULT_VALIDATOR_ID, 1); takes back the smallest possible amount, 1 wei. A "wei" is the tiniest unit of a token. The point is not the amount but the side effect: it triggers another reward update.
  • vm.stopPrank(); stops acting as user1.
  • uint256 commission = ValidatorFacet(address(diamondProxy)).getAccruedCommission(DEFAULT_VALIDATOR_ID, address(pUSD)); asks the system how much commission has built up so far.
  • assertGt(commission, 0, "Commission should be greater than 0"); checks that the answer is greater than zero. assertGt means "assert greater than". If it were zero, the test would stop here, because there would be nothing to claim.
  • vm.startPrank(validatorAdmin); acts as the validator admin.
  • uint256 balanceBefore = pUSD.balanceOf(validatorAdmin); records the admin's PUSD balance before the claim, for comparison.
  • ValidatorFacet(address(diamondProxy)).requestCommissionClaim(DEFAULT_VALIDATOR_ID, address(pUSD)); starts the claim. This is the first of the three stages.
  • uint256 blockTimestamp = block.timestamp; saves the current time.
  • vm.warp(blockTimestamp + 7 days + 1 seconds); jumps the clock forward by seven days and one second, so the waiting period has definitely passed. This is stage two.
  • vm.startPrank(admin); acts as the admin.
  • ValidatorFacet(address(diamondProxy)).setValidatorStatus(DEFAULT_VALIDATOR_ID, false); sets the validator to inactive. false means "not active". This is the twist: it happens after the claim became eligible.
  • vm.stopPrank(); stops acting as the admin.
  • vm.startPrank(validatorAdmin); acts as the validator admin again.
  • vm.expectRevert(abi.encodeWithSelector(ValidatorInactive.selector, DEFAULT_VALIDATOR_ID)); tells the test to expect a failure, specifically the ValidatorInactive error for this validator. abi.encodeWithSelector is a way of building the exact error message the test expects.
  • ValidatorFacet(address(diamondProxy)).finalizeCommissionClaim(DEFAULT_VALIDATOR_ID, address(pUSD)); tries to collect the commission. This is stage three, and it is the call that fails.

The test sets a reward rate of 1e18 per second, funds the treasury with 100 ether of PUSD, sets a 10% commission, stakes 10 ether from user1, advances time, and triggers reward updates with a 1 ether stake from user2 and a 1 wei unstake from user1. It asserts that accrued commission is greater than zero, requests the claim as validatorAdmin, warps 7 days + 1 seconds past the request, sets the validator inactive as admin, and then expects finalizeCommissionClaim to revert with ValidatorInactive for DEFAULT_VALIDATOR_ID.

The test passes:

Text
[PASS] testValidatorCannotClaimEligibleCommission_whenSetToInactive() (gas: 1598430)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 12.36ms (1.18ms CPU time)
Ran 1 test suite in 182.91ms (12.36ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)

Reading the output: [PASS] means the test succeeded, which here means the bug was reproduced exactly as expected. gas: 1598430 is the amount of computational effort the test used; "gas" is the unit that measures work on a blockchain. The remaining lines are a summary: one test passed, none failed, none skipped, and how long it took.

Root cause

The active check in finalizeCommissionClaim is unconditional for non-slashed validators. It does not compare the claim's ready timestamp with the moment the validator became inactive, unlike the slashing branch, which compares readyTimestamp with validator.slashedAtTimestamp. As a result, a claim that was already eligible is invalidated by a later status change. The existing timelock check does not help, because it only confirms that the waiting period has passed; it says nothing about the validator's status at the time the claim became eligible.

In everyday terms: the code asks "is the validator active right now?" when it should be asking "was the claim already mature when the validator stopped being active?". The first question can change its answer at any moment; the second is a fact about the past and cannot be changed afterwards.

Impact

Any validator that requested a commission claim and became eligible to collect it before being set to inactive is prevented from collecting those rewards. The funds are temporarily frozen and can only be released if the admin re-activates the validator. The report classifies this as temporary freezing of funds for at least 24 hours.

"Temporary" is the key word. The money is not gone; it is locked behind a door that only an administrator can open. That is still a real problem, because the validator has no way to open it themselves, and the length of the freeze depends entirely on someone else's decision.

Fix

The recommendation is to modify finalizeCommissionClaim so that it allows finalisation when the claim timelock completed before the validator became inactive. The suggested change is:

Diff
function finalizeCommissionClaim(
    uint16 validatorId,
    address token
) external onlyValidatorAdmin(validatorId) nonReentrant returns (uint256) {
    ...

    // For a non-slashed validator, simply require it to be active to finalize a claim.
-    if (!validator.slashed && !validator.active) {
-        revert ValidatorInactive(validatorId);
-    }

+    bool validatorCanClaimRewards = (claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK) < validator.slashedAtTimestamp;
+    if (!validator.slashed && !validatorCanClaimRewards) {
+        revert ValidatorInactive(validatorId);
+    }
    ...
}

This is a "diff": lines starting with - are removed and lines starting with + are added. Line by line:

  • The removed if (!validator.slashed && !validator.active) { is the old check that only looks at the current status.
  • The removed revert ValidatorInactive(validatorId); is the old error it raised.
  • The added bool validatorCanClaimRewards = (claim.requestTimestamp + PlumeStakingStorage.COMMISSION_CLAIM_TIMELOCK) < validator.slashedAtTimestamp; creates a true-or-false value. It is true when the claim became ready before the moment the validator was marked inactive or slashed.
  • The added if (!validator.slashed && !validatorCanClaimRewards) { only blocks the claim when the validator was not slashed and the claim was not already mature at the time of the status change.
  • The added revert ValidatorInactive(validatorId); is the error that remains for the genuinely ineligible case.

This ensures a non-slashed validator may finalize a claim if the claim's timelock completed before the validator was marked inactive or slashed.

Variants to test

These are follow-up ideas for anyone hunting similar bugs. Each one is a way of looking for the same mistake in other places.

  1. Apply the same pattern to other two-step withdrawal flows with a timelock, such as unstaking queues or reward claims. A positive result is a finalisation function that checks only the current status and ignores when the claim became eligible.
  2. Compare the slashing branch and the inactive branch of every status-dependent function. A positive result is one branch that compares timestamps and another that does not.
  3. Test status changes that happen exactly at the boundary: a claim that becomes eligible in the same block as the status change, and one that becomes eligible one second before. A positive result is a revert for a claim that was already eligible.
  4. Check whether re-activating a validator restores the pending claim, and whether the claim can still be finalised after re-activation. A positive result is a claim that survives the round trip, which confirms the freeze is temporary rather than permanent.

Hunting notes

This kind of bug tends to hide in finalisation functions that mix a time-based eligibility check with a live status check. During recon, look for functions that revert with an "inactive" or "not active" error and check whether the revert condition uses a stored timestamp or only the current state. The signal is an asymmetry: one branch of the same function compares timestamps, the other does not.

The researcher showed impact with a Foundry test that walks the full lifecycle: accrual, claim request, timelock expiry, status change, and the revert. The test asserts that commission accrued before the claim and uses vm.expectRevert with the ValidatorInactive selector.

Glossary

  • Smart contract: a program on a blockchain that runs exactly as written and cannot be changed after deployment.
  • Blockchain: a shared record book kept by many computers, where entries are very hard to alter.
  • Staking: locking money into a system for a period in exchange for rewards.
  • Validator: a participant who helps run the network and earns a commission on rewards.
  • Timelock: a built-in waiting period before an action is allowed.
  • Revert: a smart contract cancelling an operation and returning an error.
  • Admin: an account with special powers, here the power to change a validator's status.
  • Diamond proxy: one main contract that forwards requests to smaller contracts called facets.
  • Facet: a smaller contract handling one area of a diamond proxy's work.
  • Token: a digital currency issued on a blockchain; PUSD is the one used here.
  • Treasury: the pot of money the system pays rewards from.
  • Address: a blockchain account identifier, like an account number.
  • Slashed: punished by having some staked money taken away for misbehaviour.
  • Pending claim: a record of money requested but not yet collected.
  • Timestamp: a recorded moment in time.
  • Block: a batch of transactions on a blockchain; the block number counts them.
  • Gas: the unit measuring computational effort on a blockchain.
  • Wei: the smallest unit of a token.
  • Proof of concept: a small demonstration that shows a bug really happens.
  • Prank: a test tool that makes calls look like they come from a chosen account.
  • Warp: a test tool that moves the simulated clock forward.
  • Roll: a test tool that moves the simulated block number forward.
  • Assert: a test check that stops the test if the expected condition is not met.
  • Diff: a display of code changes, with - for removed lines and + for added lines.
  • Recon: the research phase where you read code and look for weak spots before trying anything.
  • Asymmetry: a difference in behaviour between two parts that should logically match.

More from Plume Network

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.