The requestMintWeatherNFT function increments s_currentMintPrice by s_stepIncreasePerMint immediately upon being called, before the Chainlink Functions request to fetch weather data is initiated and long before the NFT is actually minted in fulfillMintRequest.
If the Chainlink Functions call fails (e.g., oracle error, JavaScript error in GetWeather.js, API unavailability) or if fulfillMintRequest subsequently fails for any reason (e.g., invalid data from oracle, keeper registration failure), the minting process is aborted. However, s_currentMintPrice is not decremented back to its original value. This means that the user who experienced the failed mint, or any subsequent user, will face a higher mint price for their next attempt, even though the previous attempt did not result in a successful NFT mint. This penalizes users for system or oracle failures beyond their control.
Likelihood: High
Oracle calls or subsequent minting steps can fail due to various reasons (API issues, JavaScript errors, Chainlink node issues, misconfigurations, gas problems). Each such failure will leave the mint price unfairly inflated.
Impact: Medium
Financial Penalty for Users: Users trying to mint again after a failure, or new users, have to pay a higher price that was increased due to a system error, not a successful mint.
Deteriorating User Experience: Makes the minting process appear unreliable and potentially costly if multiple attempts are needed due to external factors.
Potential for Price Griefing (Minor): A malicious actor could repeatedly initiate mint requests they know might fail (e.g., by providing parameters likely to cause an error in GetWeather.js if such inputs exist, or by trying to front-run/disrupt the oracle response) to drive up the price for legitimate users, although this is less direct. The primary issue is the unfair increase from non-malicious failures.
s_currentMintPrice is 1 ETH. s_stepIncreasePerMint is 0.1 ETH.
Alice calls requestMintWeatherNFT sending 1 ETH. Inside the function, s_currentMintPrice becomes 1.1 ETH.
The Chainlink Functions call made on Alice's behalf fails (e.g., GetWeather.js throws an error, or OpenWeather API is down).
The oracle returns an error to fulfillRequest, which populates s_funcReqIdToMintFunctionReqResponse[requestId].err.
Alice (or an automated system) calls fulfillMintRequest(requestId). The function sees err.length > 0 and returns. Alice does not get an NFT. Her 1 ETH might be stuck (as per another reported issue).
Bob now wants to mint. He checks s_currentMintPrice and sees it is 1.1 ETH. He has to pay 0.1 ETH more because Alice's mint attempt failed due to an oracle error.
Increment s_currentMintPrice only after a successful mint has occurred (i.e., at the end of fulfillMintRequest just before NFT is minted or state is finalized for the new NFT).
Self-correction during mitigation suggestion: s_tokenCounter should also be incremented only upon successful mint, not when fulfillMintRequest is entered. I've adjusted the diff for s_tokenCounter++ to be near s_currentMintPrice += s_stepIncreasePerMint;.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.