Skip to content
Business logic Audit finding Intermediate

Contradictory Documentation and actual function

The RewardSettings contract's variable name and comment contradict the actual calculation logic, so an admin could misconfigure the reward cap and unintentionally allow a single wallet to claim a large share of epoch rewards.

xdead4f Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#41256 [SC-Insight] Contradictory Documentation and actual function

Submitted on Mar 13th 2025 at 03:27:02 UTC by @xdead4f for Audit Comp | Yeet

Description

Brief/Intro

The RewardSettings.sol contract contains critical inconsistencies between variable names, comments, and actual implementation logic, creating significant risk of misunderstanding by developers, auditors, and users. This misconception could lead to unexpected reward distribution behavior and potential exploitation.

Vulnerability Details

RewardSettings.sol: Variable MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR
Reward.sol: Integration with the above variable in reward calculation logic

The variable MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR has a comment stating:

constructor() Ownable(msg.sender) {
        /// @dev this is in percentage, 1/10 of the total rewards
        MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR = 30;
    }

This comment suggests:

  1. The value represents a percentage
  2. It should equate to "1/10" of total rewards
  3. But is initialized to 30

These statements are internally inconsistent and don't align with how the value is actually used.

Impact Details

  1. Unintended Reward Distribution: If an admin intends to increase the reward cap by increasing the parameter value (based on its name), they would actually be decreasing the maximum reward.
  2. Whale Exploitation Risk: If mistakenly set too low (e.g., 2 instead of 20), a single wallet could claim up to 50% of epoch rewards, potentially draining the reward pool unfairly.

Proof of Concept

Given this scenario :

  1. Current setting: 30 → Max reward = ~3.33% of epoch rewards
  2. Admin wants to double maximum rewards
  3. Misled by documentation, changes to 60
  4. Actual result: Max reward = ~1.67% (halved instead of doubled)

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

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 variable name and comment describe the value as a percentage that increases the cap, while the reward calculation divides by it, so the meaning is inverted.

Impact

An admin could unintentionally reduce the cap, or if set too low, a single wallet could claim up to 50% of epoch rewards and drain the pool unfairly.

What the attacker needed

Admin misconfigures the reward cap

The fix

The variable name and comment should be corrected to match the actual division logic, or the logic should be changed to match the documented percentage behaviour.

How it was found

  1. Current setting is 30, giving a maximum reward of about 3.33% of epoch rewards.
  2. Admin wants to double the maximum reward.
  3. Misled by the documentation, the admin changes the value to 60.
  4. The actual result is a maximum reward of about 1.67%, halved instead of doubled.

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.

A smart contract stores a number that controls the maximum reward one wallet can get. The name and comment suggest bigger numbers mean bigger rewards, but the code actually divides by that number, so bigger numbers mean smaller rewards. An admin following the misleading documentation could accidentally let one wallet take a huge share of the rewards.

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 xdead4f

View all

1 more disclosed report, best first.

More from Yeet

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.