Using block.timestamp
, block.prevrandao
, msg.sender
or block.number
as a source of randomness is commonly advised against, as the outcome can be manipulated.
The _battle()
function in contract RapBattle
is using block.timestamp
, block.prevrandao
and msg.sender
as source of randomness.
The code below shows how the, supposedly, random value is being calculated:
An attacker can precompute valid "random" numbers to win every battle.
Manual analysis.
Consider using a decentralized oracle for the generation of random numbers, such as Chainlinks VRF.
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.