The Clock::get().unwrap() call in the contribute function can cause a panic if the Solana runtime fails to provide the Clock sysvar. This results in the entire transaction failing, leading to a Denial-of-Service (DoS) risk for users trying to interact with the contract.
1.The Solana runtime fails to provide the Clock sysvar, Clock::get().unwrap() returns an Err.
2.Since .unwrap() forces the program to panic on Err, execution is halted, and the transaction fails.
3.This leads to failed contributions, blocking fundraising operations
Medium
Manual
Replace .unwrap() with proper error handling using map_err() to return a controlled error instead of panicking:
It is very unlikely `Clock::get` to fail, therefore I think it is safe to use `unwrap` here. Consider this issue as informational.
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.