The amount of APT received is supposed to be random, apparently by making use of the Aptos randomness API.
The randomnesss is wrongly implemented. Instead, the amount of APT received is totally dependent on the timestamp.
There's no direct risk from the attacker as the get_random_slice
function is only invoked after the register_pizza_lover
function is called which can
only be executed by the contract owner.
It simply makes it unfair since the amount of APT received by pizza lovers will vary depending on the exact time their address was registered
by the contract owner.
Likelihood:
High
Impact:
Unfair distribution of APT.
Implement the randomness correctly and
Also, add the folowing attribute on top of the register_pizza_lover
function:
And the these 2 lines in each one of the tests to use randomness:
These are to initialise randomness for use in a testing environment.
The `get_random_slice` function should only be called by the owner via the `register_pizza_lover` function. Also, the `owner` is trusted and will not choose a specific time for a new user to register. Therefore, I disagree with the claim of most reports in this group that an attacker can manipulate the random number of pizza slices. But I agree with the root cause of the reports in this group, that the random distribution is not completely random.
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.