ChoosingRam:increaseValuesOfParticipants() is intended to be called by RamNFT owners until 12th October 2024 in an attempt to increase their characteristics and be selected as Ram if all of them are true.
If the Ram has not been selected this way before 12th October 2024, the organiser will be able to call ChoosingRam:selectRamIfNotSelected() to forcefully select a Ram.
Both functions are protected by the RamIsNotSelected modifier which reverts if the state variable isRamSelected == false.
The issue is found in the fact that isRamSelected is only updated inside selectRamIfNotSelected() and not in increaseValuesOfParticipants().
This means that, even if the users selected a Ram via increaseValueOfParticipants(), the organiser will be still able to forcefully overwrite it by calling selectRamIfNotSelected().
A smart contract organiser will always win and claim 100% of the fee pot because he can simply call selectRamIfNotSelected() and revert if he's not the selectedRam.
Causing a critical loss of funds for the participants which have no way to win.
Add the following file to the test folder:
Manual Review
Foundry
Make sure that:
isRamSelected is set to true whenever someone is chosen to be the Ram in ChoosingRam:increaseValuesOfParticipants().
the randomness both in increaseValuesOfParticipants() and selectRamIfNotSelected()) should be computed via ChainLink VRF with a 1 block waiting (like in NFTs collection drops) so that smart contract participants can't revert in unfavorables conditions for them.
Additionally, you can consider implementing a delay between calls to ChoosingRam:increaseValuesOfParticipants(), to make impossible to win in a single transaction by using a smart contract.
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.