RapBattle::_battle()
uses the hash of block.timestamp
, block.prevrandao
, msg.sender
, and totalBattleSkill
to determine a winner but this is known to be predictable.
Inside of RapBattle::_battle()
it declares a local variable of type uint256 called random
:
The value of random
is assigned by hashing block.timestamp
, block.prevrandao
, msg.sender
, and totalBattleSkill
. Since block.timestamp
, block.prevrandao
, msg.sender
, and totalBattleSkill
can all be known at the time of execution, this allows a user to know the value of random
and ultimately the outcome of who wins the battle.
A user can know the outcome of the battle and call the function for a guaranteed win.
VS Code, Slither
Consider using Chainlink VRF for true 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.