Severity: Medium
The rarity distribution in selectWinner() at PuppyRaffle.sol:141-148 uses <= comparisons that produce incorrect probabilities:
The rarity variable ranges from 0 to 99 (100 possible values). With <=:
rarity <= 70 matches values 0-70: 71 values (71%, not 70%)
rarity <= 95 matches values 71-95: 25 values (25%, correct)
rarity > 95 matches values 96-99: 4 values (4%, not 5%)
The stated constants suggest 70%/25%/5% distribution, but the actual distribution is 71%/25%/4%. Legendary NFTs are 20% rarer than intended.
Impact: Medium — participants are misled about legendary NFT odds. Legendary NFTs are 20% rarer than the stated 5% chance, affecting the value proposition for raffle entrants.
Likelihood: High — the off-by-one applies to every single raffle round.
Change <= to < at PuppyRaffle.sol:141-143 to match the stated distribution:
This produces the correct 70/25/5 distribution matching the declared constants.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.