Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Invalid

A player cannot change an already made prediction without paying the `predictionFee again (which is not according to the documentation).

Summary

If a player has made a prediction once and then wishes to change it, according to the documentation, they should not have to pay the predictionFee again. The current implementation of the protocol does not support this; instead, regardless of how many times the user changes their prediction, they must pay the predictionFee each time.

Impact

No matter how many times the user changes their prediction, they will have to pay the predictionFee each time.

PoC

function test_changePrediction() public {
vm.startPrank(stranger);
vm.deal(stranger, 0.0401 ether);
thePredicter.register{value: 0.04 ether}();
vm.stopPrank();
vm.startPrank(organizer);
thePredicter.approvePlayer(stranger);
vm.stopPrank();
vm.startPrank(stranger);
thePredicter.makePrediction{value: 0.0001 ether}(
1,
ScoreBoard.Result.Draw
);
vm.stopPrank();
/////////////// TRY TO CHANGE PREDICTION ////////////////////
assertEq(stranger.balance,0);
vm.startPrank(stranger);
vm.expectRevert(); //We expect a revert because it is not possible to change the prediction for free
thePredicter.makePrediction{value: 0 ether}(
1,
ScoreBoard.Result.First
);
vm.stopPrank();
vm.startPrank(stranger);
vm.expectRevert(); //We expect a revert because it is not possible to change the prediction for free and user do not have money for it
thePredicter.makePrediction{value: 0.0001 ether}(
1,
ScoreBoard.Result.First
);
vm.stopPrank();
}

Recommendations

This can be corrected, for example, by creating a separate function for this purpose. In this function, make sure to check if the player has already made their initial prediction and paid the required fee for the first prediction for the given match.

Updates

Lead Judging Commences

NightHawK Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Appeal created

elprofesor Submitter
11 months ago
NightHawK Lead Judge
11 months ago
NightHawK Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.