Summary
contracts/tholos/src/lib.rs has two bare .unwrap() calls on invariant-backed values, at line 784 (assertion.disputer.clone().unwrap()) and lines 874/876 (resolvers.get(i).unwrap() / resolvers.get(j).unwrap()). Both are provably safe given the surrounding invariants (a disputed assertion always has a disputer; the loop bounds never exceed resolvers' length), but v2 consistently uses self-documenting .expect("...") for equivalent invariant-backed unwraps instead of bare .unwrap(). This is a readability/convention fix, not a correctness fix, nothing here is actually reachable as a panic.
Scope
- Replace the three
.unwrap() calls (line 784, 874, 876) with .expect("..."), each message stating the invariant that makes it safe (e.g. why disputer is guaranteed Some at that point, why the index is guaranteed in bounds).
- No behavior change. No new tests required, this doesn't change what's reachable, only what a panic message says if the invariant were ever violated.
Proposed approach
Read the code immediately preceding each call site to state the actual invariant precisely in the .expect() message (not a generic "should never happen"), matching the style already used throughout contracts/tholos-v2/src/lib.rs's .expect() calls.
Summary
contracts/tholos/src/lib.rshas two bare.unwrap()calls on invariant-backed values, at line 784 (assertion.disputer.clone().unwrap()) and lines 874/876 (resolvers.get(i).unwrap()/resolvers.get(j).unwrap()). Both are provably safe given the surrounding invariants (a disputed assertion always has adisputer; the loop bounds never exceedresolvers' length), but v2 consistently uses self-documenting.expect("...")for equivalent invariant-backed unwraps instead of bare.unwrap(). This is a readability/convention fix, not a correctness fix, nothing here is actually reachable as a panic.Scope
.unwrap()calls (line 784, 874, 876) with.expect("..."), each message stating the invariant that makes it safe (e.g. whydisputeris guaranteedSomeat that point, why the index is guaranteed in bounds).Proposed approach
Read the code immediately preceding each call site to state the actual invariant precisely in the
.expect()message (not a generic "should never happen"), matching the style already used throughoutcontracts/tholos-v2/src/lib.rs's.expect()calls.