Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

Usage of Custom Errors save gas Cost

Summary

LevelOne::giveReview function should use custom errors to save some gas cost

Vulnerability Details

require(reviewCount[_student] < 5, "Student review count exceeded!!!");
require(block.timestamp >= lastReviewTime[_student] + reviewTime, "Reviews can only be given once per week");

Impact

Not using Custom errors for checks increase the gas cost

Recommendations

- require(reviewCount[_student] < 5, "Student review count exceeded!!!");
- require(block.timestamp >= lastReviewTime[_student] + reviewTime, "Reviews can only be given once per week");
+ error HH__StudentReviewCountExceeded();
+ error HH__StudentGivenMoreThanOneReviewPerWeek();
+ if(reviewCount[_student] >4){
+ revert HH__StudentReviewCountExceeded();
+ };
+ if(block.timestamp < lastReviewTime[_student] + reviewTime){
+ revert HH__StudentGivenMoreThanOneReviewPerWeek();
+ };
Updates

Lead Judging Commences

yeahchibyke Lead Judge 4 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.