reentrancy
attacks if external calls are made before state updates.contribute
function, the Checks-Effects-Interactions (CEI) pattern is not properly implemented. Specifically, it performs interactions (transferring SOL) before updating the state (effects), potentially introducing vulnerabilities. The contribute
function does interactions (SOL transfer) before effects (updating fund.amount_raised
), violating CEI.reentrancy
attacks if external calls are made before state updates.The current order could lead to an inconsistent state if the SOL transfer fails after partial state updates, though in this case, the transfer precedes state changes.
Checks: Validate conditions (e.g., deadline
, contribution amount
).
Effects: Update the state (e.g., contribution.amount
, fund.amount_raised
).
Interactions: Perform the SOL transfer.
Ensure all state changes occur before any external interactions.
The reentrancy attacks occur when the contract modifies state and makes an external call, allowing the attacker to reenter. The `contribute` function doesn't perform an external call. For the SOL transfer the function uses a system program, not an external call to another smart contract. Therefore, there is no attack vector for reentrancy.
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.