It is possible to predict when the the treat will be double-priced or half-priced due to bad randomness used in the SpookySwap::trickOrTreat
function.
There is no way to generate a random value on-chain in EVM. The function SpookySwap::trickOrTreat
uses the expression below to generate a "random" value:
There are some problems with this code:
Validators can manipulate block.timestamp
value in some degree, so a validator can affect the random value generation
Users can calculate the same value in their transaction and based on the calculated value decide to call SpookySwap::trickOrTreat or not
Price of the treat can be manipulated by validators, or users can just revert the transaction if the price does not satisfy them.
Manual review
Do not rely on any on-chain value to generate a random values. Consider to use Chainlink VRF for that purpose.
It's written in the README: "We're aware of the pseudorandom nature of the current implementation. This will be replaced with Chainlink VRF in later builds." This is a known issue.
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.