Skip to content
Business logic Audit finding Intermediate

Logic error in streak validation causes legitimate jackpot wins to be denied, violating reward contract expectations

The Spin contract checks jackpot eligibility using the user's streak count from before the current spin, so a user who reaches the required streak during that spin is denied the jackpot. The spin fee is still taken, and the user loses a reward they had earned.

Bug82427 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

50450 sc high logic error in streak validation causes legitimate jackpot wins to be denied violating reward contract expectations

Submitted on Jul 24th 2025 at 19:18:58 UTC by @Bug82427 for Attackathon | Plume Network

Description

In the Spin contract, jackpot eligibility is determined during handleRandomness() by checking whether userDataStorage.streakCount is greater than or equal to (currentWeek + 2). However, this streak count reflects the user’s state before the current spin. Since updateUserData() is called after this check, users spinning their way into jackpot eligibility are denied their rightful rewards.

This is a classic logic flaw in state-dependent access control, where stale state is used to make a reward decision. The impact is that users who legitimately earn jackpot eligibility during their current spin will have their win silently discarded if they land on the jackpot, despite meeting all conditions.

While no funds are stolen or transferred, the jackpot — which should have been won — is withheld. The spin fee is still consumed and non-refundable. This results in broken reward mechanics and undermines user trust. The jackpot funds remain in the contract but the user’s reward is lost forever due to a flawed conditional check.

Proof of Concept

Assumptions:

  • currentWeek = 3
  • Jackpot eligibility requires streakCount ≥ currentWeek + 2 = 5
  • Player Alice has streakCount = 4 before spinning
  • Alice is about to spin and successfully lands on a jackpot

Execution trace (stepper):

{% stepper %} {% step %}

Alice starts the spin

  • Alice calls startSpin().
  • She pays the 2 PLUME fee.
  • A random request is sent to the Supra VRF.
  • Her request ID is stored. {% endstep %}

{% step %}

Oracle returns randomness

  • The Supra oracle later calls handleRandomness(...) with a result corresponding to rewardCategory = "Jackpot".
  • Inside handleRandomness(), the contract retrieves Alice’s userDataStorage:
    • streakCount == 4
    • lastSpinWeek == currentWeek == 3
  • During this spin, streakCount would be incremented to 5 by updateUserData(), but that update has not yet run. {% endstep %}

{% step %}

Eligibility check uses stale state

  • Before updateUserData() is called, the contract checks eligibility:
Solidity
if (userDataStorage.streakCount < (currentWeek + 2)) {
    revert InvalidSpin("Not enough streak");
}
  • Since streakCount == 4, this check fails, even though the user would reach 5 during this spin. {% endstep %}

{% step %}

Outcome

  • Jackpot reward logic is skipped entirely, and the spin ends with a revert or lower reward.
  • updateUserData() is only called after the reward condition is checked, so Alice is wrongly denied the jackpot. {% endstep %} {% endstepper %}

Conclusion

State-dependent reward checks use a stale streakCount (pre-spin) before updateUserData() runs, which causes legitimate jackpot wins earned during the current spin to be denied. This breaks the reward mechanics: users pay the spin fee but may be incorrectly prevented from receiving a jackpot they earned that same spin.

References

The original report as published on Immunefi, by Bug82427. 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 jackpot eligibility check reads the stored streak count before the function that increments it for the current spin has run, so the decision uses stale state.

Impact

A user who legitimately earns jackpot eligibility during a spin could have that win silently discarded, while the spin fee is still consumed and non-refundable.

What the attacker needed

A user with a streak one below the jackpot threshold; the spin lands on the jackpot reward

How it was found

  1. Alice calls startSpin() and pays the spin fee.
  2. The oracle returns randomness that maps to the jackpot reward.
  3. The contract reads Alice's stored streak count, which is still the pre-spin value.
  4. The eligibility check fails because the streak is below the required threshold.
  5. The jackpot logic is skipped and the spin ends with a revert or lower reward.

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 is a program on a blockchain that runs automatically. This one gives a jackpot to players who have spun a certain number of weeks in a row. The bug is that it checks the player's streak before adding the current spin, so a player who just reached the needed streak is told they are not eligible and loses the prize.

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 Bug82427

View all

5 more disclosed reports, best first.

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.