The battle() function emits an incorrect winner value in some cases.
On emit Battle()
, the code checks if random
is less than defenderRapperSkill
, but this is incorrect. It should be checked if it is less than or equal, as indicated later. ("If random <= defenderRapperSkill -> defenderRapperSkill wins")
In this test, we look for a block where random
is equal to defenderRapperSkill
, and we verify that the winner in that case is incorrect.
Test passes
Eventually, the event will emit an incorrect winner address, which can negatively affect dapps.
Foundry, Manual review
Correct the event in _battle():
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.