Problem
explorer/src/lib.rs contains ~20 unwrap() / panic! / todo! sites. In a Soroban contract, an unhandled panic aborts the invocation and can be triggered by malformed or unexpected input, which is a poor and potentially exploitable failure mode. State-reading getters that unwrap() on absent storage (for example an uninitialised admin) will panic rather than return a typed error.
What needs to be done
- Enumerate every
unwrap()/panic!/todo! in explorer/src/lib.rs.
- For each, determine whether it can be reached by untrusted input or by calling a function before
init.
- Replace reachable ones with typed
Error returns (Result<_, Error>) or panic_with_error! using the existing error enum, so failures are explicit and typed.
- Leave only invariant-guaranteed unwraps, each with a justifying comment.
Files
Acceptance deliverables
- No
unwrap()/panic! reachable from untrusted input without a typed error or a documented invariant.
- Calling state getters before initialisation returns a typed error rather than an untyped panic.
Tests to pass
- Tests asserting typed errors for pre-init calls and for invalid inputs on the audited functions.
cargo test passes.
Problem
explorer/src/lib.rscontains ~20unwrap()/panic!/todo!sites. In a Soroban contract, an unhandled panic aborts the invocation and can be triggered by malformed or unexpected input, which is a poor and potentially exploitable failure mode. State-reading getters thatunwrap()on absent storage (for example an uninitialised admin) will panic rather than return a typed error.What needs to be done
unwrap()/panic!/todo!inexplorer/src/lib.rs.init.Errorreturns (Result<_, Error>) orpanic_with_error!using the existing error enum, so failures are explicit and typed.Files
explorer/src/lib.rsAcceptance deliverables
unwrap()/panic!reachable from untrusted input without a typed error or a documented invariant.Tests to pass
cargo testpasses.