TwentyOne

First Flight #29
Beginner FriendlyGameFiFoundrySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

block.prevrandao not available in solidity 0.8.13

Summary

The .prevrandao method is not available on the version of solidity used in the contract. The functionaly will not work as expected when drawing a card. This impacts the entirely gameflow as a result.

Vulnerability Details

// Generate a random index
uint256 randomIndex = uint256(
keccak256(
abi.encodePacked(block.timestamp, msg.sender, block.prevrandao)//@audit - what is prevrandao???
)
) % availableCards[player].length;

Impact

No randomness means the drawcard function and entire game can be gamed. Risk of total loss of funds for the contract.

Tools Used

Manual Review

Recommendations

Implement an alternative form of pseudo-randomness.

Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

`block.prevrandao` usage fails with pragmas below 0.8.18

Support

FAQs

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