RustFund

First Flight #36
Beginner FriendlyRust
100 EXP
View results
Submission Details
Severity: medium
Valid

Missing update on `fund.amount raised` in `pb fun refund` function

Summary

The function does not update fund.amount_raised when a refund is processed. This results in an inconsistent state, where the contract still reflects the original raised amount, even though funds have been withdrawn.

Vulnerability Details

fund.amount_raised is not updated in refund function.

Impact

The contract's state becomes inaccurate, affecting logic that depends on amount_raised.

Tools Used

Manual

Recommendations

Update fund.amount_raised to accurately reflect refunds:

ctx.accounts.fund.amount_raised = ctx.accounts.fund.amount_raised.checked_sub(amount)
.ok_or(ErrorCode::CalculationOverflow)?;
Updates

Appeal created

bube Lead Judge 8 months ago
Submission Judgement Published
Validated
Assigned finding tags:

`amount_raised` not updated in `refund` function

Support

FAQs

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