The contract uses Clock::get().unwrap()
and try_into().unwrap()
calls directly, which can panic if the clock data is inaccessible or invalid. This triggers a chain halt (panic) instead of a graceful error.
Snippets like:
If Clock::get()
fails (or try_into()
fails on negative or out-of-range timestamps), the entire transaction panics rather than returning an error code.
Denial of Service: Attackers might cause ephemeral environment conditions that break Clock
usage, halting the program’s function for all users.
Loss of Control Flow: Safe pattern in Rust is to return a Result
instead of an unrecoverable panic.
Manual call analysis .unwrap() in time acquisition chains.
Comparison with recommendations for safe error handling in on-chain Rust code.
Replace all unwrap() calls with error handling using the operator ? or explicitly matching with Result to correctly return an error instead of panicking.
Define your own ErrorCode for situations when Clock is unavailable or conversion is not working.
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.