Clock/timestamp unwrap() panics and fragile i64-to-u64 conversion in time handlingcontribute (lib.rs:29) and refund (lib.rs:69) read the clock and convert the timestamp with chained unwrap()s, and compare a deadline: u64 against an i64 unix_timestamp via try_into().unwrap(). Any failure panics the instruction, and the signed-to-unsigned conversion is brittle.
Likelihood:
Clock::get() failure is rare, and unix_timestamp is non-negative under normal validator conditions, so a panic is unlikely in practice. The conversion is nonetheless unsound by construction (no guarantee the i64 is in u64 range) and relies on a runtime invariant rather than the type system.
Impact:
A failed unwrap() aborts the instruction with a non-descriptive panic instead of a typed error, degrading diagnosability. The u64 deadline vs i64 timestamp mismatch is an accident waiting to happen if either side's representation changes, and inconsistent time typing across instructions makes the deadline logic harder to reason about and audit.
Static/logic review: the two unwrap()s on Clock::get() and try_into() are infallible-by-assumption, not by contract — a returned error or out-of-range value panics rather than producing ErrorCode. No on-chain trigger needed to demonstrate the unsound pattern.
Propagate errors with ? and use a consistent timestamp type instead of unwrap().
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.