Redundant raffle ticket balance check
The Spin contract repeats a raffle ticket balance check that the Raffle contract already performs before calling it. This redundancy adds gas overhead and code duplication without improving security.
- Disclosed after under an hour
52937 sc insight redundant raffle ticket balance check
Submitted on Aug 14th 2025 at 12:15:38 UTC by @Am3nh3l for Attackathon | Plume Network
- Report ID: #52937
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/spin/Spin.sol
- Impacts:
Description
Brief/Intro
The Spin contract contains a redundant balance check in its spendRaffleTickets function that duplicates functionality already implemented in the Raffle contract. This creates unnecessary gas overhead and code redundancy without adding security benefits.
Vulnerability Details
The Raffle contract already performs a sufficient ticket balance check before calling spendRaffleTickets:
// Raffle.sol - Line 194
(,,,, uint256 userRaffleTickets,,) = spinContract.getUserData(msg.sender);
if (userRaffleTickets < ticketAmount) revert InsufficientTickets();
Despite this, the Spin contract repeats the same check:
function spendRaffleTickets(address user, uint256 amount) external onlyRaffleContract {
UserData storage userDataStorage = userData[user];
require(userDataStorage.raffleTicketsBalance >= amount, "Insufficient raffle tickets");
// ...
}
This redundancy exists because:
- The Raffle contract is the only caller (via
onlyRaffleContract) - The Raffle contract already verifies sufficient balance
- The Spin contract cannot be called independently for ticket spending
Impact Details
(Impact details not provided in original report.)
References
(Add any relevant links to documentation or code)
Proof of Concept
(Proof of Concept not provided in original report.)
Proof of Concept
Insight
<details> <summary>Raw target file</summary>https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/spin/Spin.sol
</details>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
The Spin contract duplicates a balance check that its only caller, the Raffle contract, already performs.
Impact
The redundancy causes unnecessary gas overhead and code duplication, but does not create a security vulnerability.
What the attacker needed
None
The fix
The redundant check in Spin should be removed, since the Raffle contract already enforces the balance.
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 code on a blockchain. Here, one contract (Raffle) checks that a user has enough tickets before calling another contract (Spin) to spend them. Spin then checks the same thing again, which wastes a little computing power (gas) and makes the code longer without making it safer.
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.