The drawCard
function chooses a random card out of the available cards in the deck. A random card is important to the game as it represents a shuffled card deck.
The call
function compares the hands of the player and the dealer. It chooses a threshold randomly.
Using onchain data to generate a random number is considered a bad practice. On chain information is shared to all users. This allows nodes that can see the meme pool to manipulate the data for their service.
Let's consider the following scenario:
Bob has started a game.
Bob is a bad actor and can manipulate on chain data for their benefit.
Bob manipulates the timestamp for the transaction so the hash will end up with a random number that will let them win.
Bob steals 2 ETH from the protocol. Not winning by playing the game as it is supposed to be.
Slither
Consider using Oracles to generate a pure random number. Chainlink VRF oracles allow using their off chain capabilities to generate a true random number that cannot be manipulated.
Randomness Manipulation: The randomness mechanism relies on block.timestamp, msg.sender, and block.prevrandao, which may be predictable in certain scenarios. Consider using Chainlink VRF or another oracle for more secure randomness.
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.