You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@sankalpsthakur, #639 is close to completing Challenge 29. It meets every success criterion, and three things are left before we can call the challenge complete.
1. Restore the contract on the sized Box<MaybeUninit<T>>::assume_init.model-checking/kani#4984 is fixed by model-checking/kani#4985, which main's Kani pin (53cb531) has included since #766. I uncommented the requires/ensures locally and they compile and verify: proof_for_contract harnesses for i32, bool and () pass, and a slot holding byte 2 is rejected by the precondition. Please drop the TODO, attach the contract, and replace the assume_init_mirror harnesses with proof_for_contract ones.
2. "Producing an invalid value" needs -Z valid-value-checks in CI. The contracts already check the value where they evaluate can_dereference, which includes has_valid_value even without the flag. That's why the byte-2 bool is rejected. To claim the property for the whole solution, though, CI has to run these harnesses with -Z valid-value-checks, the way #777 (draft) does for Challenge 2. I ran all 71 harnesses with the flag:
Kani
Pass
Failures
53cb531 (pinned)
47
24, all unsupported checks: copy_nonoverlapping (12), raw pointer dereference (10), mutable cast (2)
10, all raw pointer dereferences of a dyn pointee: every downcast, downcast_unchecked and dyn Any deref harness
No harness found an invalid value, and the bool harnesses give the check something to find. Two Kani changes are needed before the flag can pass on every harness:
Once both are in a Kani pin, a CI job like #777's can run this challenge's harnesses with the flag.
3. "Mutating immutable bytes" waits on the ruling in #733. Kani has no aliasing model, so no Kani-based solution can check it today.
When the ruling in #733 is in and the flag passes in CI, please open a PR that marks the challenge as resolved, the same way #663 did for Challenge 12: set the status and solution in doc/src/challenges/0029-boxed.md, and update the Challenge 29 row in the README. We'll consider the challenge complete once that PR merges.
Would you also be up for writing a short blog post about what these proofs guarantee for Box and ThinBox, and what they don't? It would help us share the result with the wider Rust community.
Activity
Challenge 29: Verify safety of Box functions
feliperodri commentedon Nov 21, 2026
@sankalpsthakur, #639 is close to completing Challenge 29. It meets every success criterion, and three things are left before we can call the challenge complete.
1. Restore the contract on the sized
Box<MaybeUninit<T>>::assume_init. model-checking/kani#4984 is fixed by model-checking/kani#4985, whichmain's Kani pin (53cb531) has included since #766. I uncommented therequires/ensureslocally and they compile and verify:proof_for_contractharnesses fori32,booland()pass, and a slot holding byte 2 is rejected by the precondition. Please drop the TODO, attach the contract, and replace theassume_init_mirrorharnesses withproof_for_contractones.2. "Producing an invalid value" needs
-Z valid-value-checksin CI. The contracts already check the value where they evaluatecan_dereference, which includeshas_valid_valueeven without the flag. That's why the byte-2boolis rejected. To claim the property for the whole solution, though, CI has to run these harnesses with-Z valid-value-checks, the way #777 (draft) does for Challenge 2. I ran all 71 harnesses with the flag:53cb531(pinned)copy_nonoverlapping(12), raw pointer dereference (10), mutable cast (2)dynpointee: everydowncast,downcast_uncheckedanddyn Anyderef harnessNo harness found an invalid value, and the
boolharnesses give the check something to find. Two Kani changes are needed before the flag can pass on every harness:copy_nonoverlapping,write_bytesand mutable casts (Add support to validity checks in the presence ofcopy_nonoverlapping,copy. kani#3762);-Z valid-value-checks: raw pointer dereference of adyn Traitpointee is reported as unsupported kani#5215 (open), which is thedynpointee case.Once both are in a Kani pin, a CI job like #777's can run this challenge's harnesses with the flag.
3. "Mutating immutable bytes" waits on the ruling in #733. Kani has no aliasing model, so no Kani-based solution can check it today.
When the ruling in #733 is in and the flag passes in CI, please open a PR that marks the challenge as resolved, the same way #663 did for Challenge 12: set the status and solution in
doc/src/challenges/0029-boxed.md, and update the Challenge 29 row in the README. We'll consider the challenge complete once that PR merges.Would you also be up for writing a short blog post about what these proofs guarantee for
BoxandThinBox, and what they don't? It would help us share the result with the wider Rust community.Challenge 29: Kani contracts for Box, convert, and ThinBox (model-che…