Puppy Raffle

AI First Flight #1
Beginner FriendlyFoundrySolidityNFT
EXP
View results
Submission Details
Severity: high
Valid

Missing zero-address validation in `changeFeeAddress`

The changeFeeAddress function (L200-203) does not validate that newFeeAddress is not address(0). If the owner mistakenly sets feeAddress to the zero address, future withdrawFees calls would send ETH to address(0) via a low-level call, which succeeds on the EVM but the ETH is irretrievable.

Recommendations

Short term: Add a zero-address check:

require(newFeeAddress != address(0), "PuppyRaffle: Fee address cannot be zero");

Permalink

https://github.com/Cyfrin/4-puppy-raffle-audit/blob/df177a5c98089fb13f35bc0edff22056d59d4f93/src/PuppyRaffle.sol#L200-L203


I-1: _isActivePlayer is dead code

Severity: Informational

Type: Code Quality

Description

The internal function _isActivePlayer (L206-213) is declared but never called anywhere in the contract or its inheritance chain. Dead code increases bytecode size, deployment gas costs, and audit surface without providing any utility.

Recommendations

Short term: Remove the function entirely.

Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 4 hours ago
Submission Judgement Published
Validated
Assigned finding tags:

[H-01] Potential Loss of Funds During Prize Pool Distribution

## Description In the `selectWinner` function, when a player has refunded and their address is replaced with address(0), the prize money may be sent to address(0), resulting in fund loss. ## Vulnerability Details In the `refund` function if a user wants to refund his money then he will be given his money back and his address in the array will be replaced with `address(0)`. So lets say `Alice` entered in the raffle and later decided to refund her money then her address in the `player` array will be replaced with `address(0)`. And lets consider that her index in the array is `7th` so currently there is `address(0)` at `7th index`, so when `selectWinner` function will be called there isn't any kind of check that this 7th index can't be the winner so if this `7th` index will be declared as winner then all the prize will be sent to him which will actually lost as it will be sent to `address(0)` ## Impact Loss of funds if they are sent to address(0), posing a financial risk. ## Recommendations Implement additional checks in the `selectWinner` function to ensure that prize money is not sent to `address(0)`

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!