The contribute
function in the RustFund program fails to update the contribution.amount
field in the Contribution
account, resulting in incorrect tracking of individual contributions. While fund.amount_raised
is correctly incremented, the contribution.amount
remains unchanged (typically 0), rendering the refund mechanism ineffective as it relies on this value to determine the refund amount.
In the contribute
function:
The fund.amount_raised
is incremented by the contributed amount
.
However, contribution.amount
is not updated after the transfer, remaining at its initial value (0 if newly initialized).
The refund
function uses let amount = ctx.accounts.contribution.amount
, which will always be 0, meaning no funds are actually refunded despite the transfer occurring.
Loss of Functionality: Contributors cannot receive proper refunds because the contribution.amount
is not tracked, breaking the refund mechanism.
Financial Risk: Contributors lose their ability to recover funds if the campaign fails, as the refund amount is always 0.
Trust Issue: Undermines the platform's reliability, as contributors expect their contributions to be tracked and refundable under the specified conditions (deadline passed, goal not met).
Data Inconsistency: The total fund.amount_raised
reflects contributions, but individual contribution.amount
records do not, leading to a mismatch in accounting.
Manual review
Modify the contribute
function to update contribution.amount
alongside fund.amount_raised
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.