RustFund

First Flight #36
Beginner FriendlyRust
100 EXP
View results
Submission Details
Severity: high
Invalid

refund logic executes wrong conditional

Summary

refund function executes wrong conditional.

Vulnerability Details

therefundfunction is incorrect because we need to check if the deadline exists and is in the future to NOT revert but it's checking if deadline is not zero and is in the past return error.

https://github.com/CodeHawks-Contests/2025-03-rustfund/blob/main/programs/rustfund/src/lib.rs#L69-L71

if ctx.accounts.fund.deadline != 0 && ctx.accounts.fund.deadline > Clock::get().unwrap().unix_timestamp.try_into().unwrap() {
return Err(ErrorCode::DeadlineNotReached.into());
}

Impact

wrong logic that breaks the program.

Tools Used

manual

Recommendations

should check if the deadline is not zero and is in the future instead.

Updates

Lead Judging Commences

bube Lead Judge
2 months ago

Appeal created

bube Lead Judge 2 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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