snek_raffle::rawFulfillRandomWords
Description:
The rawFulfillRandomWords
function is designed to be called back by the Chainlink VRF Coordinator to provide the random words. However, the function signature does not match the expected signature for the Chainlink VRF Coordinator's callback function. The Chainlink VRF Coordinator expects a function with the signature rawFulfillRandomWords(uint256,uint256[])
, but the provided function signature is rawFulfillRandomWords(uint256,uint256[1])
. This will work while using the VRFCoordinatorMock contract but when working with the real implementation this wont work.
Impact:
This issue will cause the Chainlink VRF Coordinator's callback not to go through, and we would never get a winner. Because the rawFulfillRandomWords function, which chooses the winner, is never called by the VRF Coordinator contract. This failure to call back to the rawFulfillRandomWords function is a critical issue that prevents the raffle from being completed, as the winner selection process is central to the functionality of the raffle. Additionally, because of this, the raffle will always stay in calculating mode and will be unusable. This situation significantly impacts the usability and functionality of the raffle, making it impossible for participants to engage with the raffle process as intended.
Proof of Concept:
Running this command in Foundry-chisel we can calculate the function Selector for rawFulfillRandomWords(uint256, uint256[])
which is the correct signature:
But When running the singnature which is the equivalent of the snek_raffle::rawFulfillRandomWords
which is rawFulfillRandomWords(uint256,uint256[1])
we get:
It is obvious that the 0x1fe543e3
correct selector is diffrent with the one we are sending 0x4e04d708
Recommended Mitigation: When deploying to Mainnet we change the function defenition to correct function signature:
The snek_raffle::fulfillRandomWords
function should also be changed as below:
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.