RustFund

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

Missing Contribution Amount Tracking

Description

The contribution.amount field is initialized to 0 but never updated, even after a contributor sends SOL to the fund. This breaks refund logic and contribution tracking.


Impact

  • Incorrect Refunds: Contributors will receive 0 SOL on refund, even if they contributed multiple times.

  • Loss of Trust: Contributors cannot verify their total contributions.


Affected Code

// Line 41
// Initialize contribution.amount to 0
contribution.amount = 0;
// Missing: Update contribution.amount after transfer

Recommendation

Update contribution.amount using checked_add:

contribution.amount = contribution.amount
.checked_add(amount)
.ok_or(ErrorCode::CalculationOverflow)?;
Updates

Appeal created

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

Contribution amount is not updated

Support

FAQs

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