Skip to content
Business logic Audit finding Intermediate

Incorrect proportional reward splits when an operator has been slashed

The staking contract splits proportional rewards equally among all operators, assuming every bond is the same size, and never checks the actual bond after a slashing. A slashed operator whose bond was reduced to zero keeps receiving a full share, diluting the rewards of active operators.

santipu_ Follow with rzizah

Originally disclosed on Code4rena

Submitted by santipu_, also found by rzizah

autonolas-registries/../contracts/staking/StakingBase.sol #L669-L693

The StakingBase contract allows service owners to select a reward distribution type when allocating rewards. The available types are:

    enum RewardDistributionType {
        // Rewards are divided as per where stake comes from, proportional
        Proportional,
        // Rewards go to service owner
        ServiceOwner,
        // Rewards go to service multisig
        ServiceMultisig,
        // Custom rewards distribution
        Custom
    }

The function _getRewardReceiversAndAmounts determines reward allocations based on the selected distribution type. For the Proportional type:

    if (rewardDistributionType == RewardDistributionType.Proportional) {
        // Get service agent instances
        (uint256 numInstances, address[] memory agentInstances) = IService(serviceRegistry).getAgentInstances(serviceId);

        // Total number of receivers: 1 (serviceOwner) + numInstances (number of operators)
        uint256 totalNumReceivers = numInstances + 1;

        // Allocate arrays
        receivers = new address[](totalNumReceivers);
        amounts = new uint256[](totalNumReceivers);

        // Default setup implies that all bonds are equal
        // Get each operator reward
        uint256 operatorReward = reward / (totalNumReceivers);

        // Get corresponding operators and set operators reward amounts
        for (uint256 i = 0; i < numInstances; ++i) {
            receivers[i] = IService(serviceRegistry).mapAgentInstanceOperators(agentInstances[i]);
            amounts[i] = operatorReward;
        }

        // Set service owner address and its reward amount
        receivers[numInstances] = serviceOwner;
        // Service owner gets its reward amount and a division remainder, if any
        amounts[numInstances] = reward - (numInstances * operatorReward);

As noted in the comments, this logic assumes all operator bonds are equal. Each operator is assigned an equal portion of the reward, under the assumption that each has deposited the same bond amount. However, this approach fails when an operator has been slashed.

Example scenario:

  1. A service has three instances, managed by Bob, Alice, and Charlie.
  2. Each operator has deposited 100 OLAS as bond, entitling each to 25% of the rewards (with the remaining 25% going to the service owner).
  3. Bob’s instance malfunctions and is fully slashed by Alice and Charlie, reducing his bond to zero (via ServiceRegistry::slash).
  4. Despite this, StakingBase is unaware of the slashing and continues allocating 25% of the rewards to Bob.
  5. Bob now earns rewards without contributing any stake or activity, diluting the rewards meant for the active, legitimate operators.

As illustrated, the proportional distribution mechanism becomes inaccurate as soon as one or more operators are slashed. Slashed operators continue to receive rewards, reducing the effective share of active participants.

The only mitigation in the current design is for the service owner to unstake and restake the service, which may be blocked by minStakingDuration. Even if unstaking is possible, doing so mid-period would forfeit part of the earned rewards, making the loss unavoidable.

Recommended mitigation steps

Update _getRewardReceiversAndAmounts so that when the distribution type is Proportional, the function queries the actual bond amounts for each operator. Operators with reduced or zero bonds (due to slashing) should receive proportionally less or no rewards. This ensures accurate and fair distribution.


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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the reward split divides the total equally by receiver count instead of reading each operator's current bond, so slashed bonds are ignored.

Impact

Slashed operators could keep earning rewards without stake, reducing the effective share of active participants; the only workaround is unstaking and restaking, which may be blocked by the minimum staking duration and would forfeit part of the earned rewards.

What the attacker needed

Service uses proportional rewards; an operator has been slashed

The fix

The reward function should be updated to query each operator's actual bond and pay proportionally less, or nothing, to operators whose bond was reduced by slashing.

How it was found

  1. A service has three instances run by three different operators.
  2. Each operator deposits an equal bond, giving each a quarter of rewards with the rest to the service owner.
  3. One operator's instance malfunctions and is fully slashed, reducing that bond to zero.
  4. The staking contract does not learn about the slashing and still allocates that operator a full share.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Operators put up a deposit, called a bond, to run part of a service and earn a share of rewards. If one misbehaves, their bond can be taken away, which is called slashing. The code still pays that operator as if their deposit were intact, so honest operators get less than they should.

What is Business logic?

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

More by santipu_

View all

13 more disclosed reports, best first.

More from Olas

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.