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

Wrong error throw

Summary

In withdrawPredictionFees and cancelRegistration functions, misleading error messages were thrown

Vulnerability Details

function withdrawPredictionFees() public {
if (msg.sender != organizer) {
- revert ThePredicter__NotEligibleForWithdraw();
}
uint256 fees = address(this).balance - players.length * entranceFee;
(bool success, ) = msg.sender.call{value: fees}("");
require(success, "Failed to withdraw");
}
function cancelRegistration() public {
if (playersStatus[msg.sender] == Status.Pending) {
(bool success, ) = msg.sender.call{value: entranceFee}("");
require(success, "Failed to withdraw");
playersStatus[msg.sender] = Status.Canceled;
return;
}
- revert ThePredicter__NotEligibleForWithdraw();//@audit wrong throw==
}

Impact

  • troubleshooting and testing the codebase could be difficult for devs

  • users will find it difficult to use the functions if they fail to pass the condition which throws those error

Tools Used

  • Manual review

Recommendations

function withdrawPredictionFees() public {
if (msg.sender != organizer) {
+ revert ThePredicter__UnauthorizedAccess();
}
uint256 fees = address(this).balance - players.length * entranceFee;
(bool success, ) = msg.sender.call{value: fees}("");
require(success, "Failed to withdraw");
}
function cancelRegistration() public {
if (playersStatus[msg.sender] == Status.Pending) {
(bool success, ) = msg.sender.call{value: entranceFee}("");
require(success, "Failed to withdraw");
playersStatus[msg.sender] = Status.Canceled;
return;
}
+ revert ("Not_Allowed_To_CancelRegistration");
}
Updates

Lead Judging Commences

NightHawK Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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