#42710 [SC-Medium] Modulo opation introduces bias during the winning yeet calculation

Submitted on Mar 25th 2025 at 13:03:42 UTC by @RNemes for Audit Comp | Yeet

  • Report ID: #42710

  • Report Type: Smart Contract

  • Report severity: Medium

  • Target: https://github.com/immunefi-team/audit-comp-yeet/blob/main/src/Yeetback.sol

  • Impacts:

    • Contract fails to deliver promised returns, but doesn't lose value

    • Theft of unclaimed yield

Description

Brief/Intro

Randomness of game results decreases due to use of the Modulo operator in selecting the winning yeets.

Vulnerability Details

The draftWinners function uses the modulo operation to select the winning yeet. The Pyth documentation mentions:

Pyth Docs

This is not an issue for a small number of yeets ie 52 but as the number of yeets per game gets larger the effects are greater and will cause a bias in the results.

Impact Details

As the number of players increase the randomness of the results decreases, which causes unfairness in the game.

References

Pyth Docs

Proof of Concept

Proof of Concept

The following test shows how the randomness changes as the no of yeets increases

Was this helpful?