Skip to content

Challenge 29: Safety of boxed #526

Closed

Description

@AlexLB99

#525

Runbook Link

Will add once there is a runbook link

Activity

  1. added
    Challenge
    on Jan 12, 2026
  2. added a commit that references this issue on Mar 26, 2026
    e6e2e11
  3. feliperodri commented on Nov 21, 2026

    @feliperodri
    Member

    @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)
    model-checking/kani#5205, on nightly-2026-11-19 61 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.

  4. added a commit that references this issue on Nov 21, 2026
    525414a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Challenge

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions