feat(gust): Kani-proven wrap-safe time-seam math (VER-OS-TIME-MATH-001, v0.5.1) - #222
Merged
Conversation
…MATH-001 (v0.5.1) Extracts the gust:os time capability's deadline/elapsed arithmetic into a verified core crate (drivers/os-time-math), Kani-proven 5/5, that the time-provider binds to instead of carrying the math inline — additional formal evidence over the test-level VER-OS-SYSCALL-001. Also fixes a latent gap: the inline elapsed was 'now >= deadline', only correct in the non-wrapping window despite the WIT documenting the helper as wrap-safe. The verified core uses the wrapping-difference half-range test that is genuinely wrap-safe (and a strict superset of >= in the practical non-wrapping regime — proven). Kani 5/5: deadline totality + deadline(now,0)==now; fresh-deadline-not-elapsed; at-deadline-elapsed; advanced-to-deadline-elapsed (wrap-safe); matches->= without wrap. Provider still builds for wasm32; gale#214 provider drift gate stays green (8/8); rivet validate PASS (333 warnings, no new diagnostics). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
v0.5.1 formal-hardening of the gust:os
timecapability, over the already-verified (test-level) VER-OS-SYSCALL-001. Extracts thedeadline/elapsedarithmetic into a small Kani-proven verified core (drivers/os-time-math) that thetime-providerbinds to, instead of carrying the math inline.Also fixes a latent correctness gap
The WIT documents
time.elapsedas wrap-safe ("elapsed once now has passed it"), but the inline impl wasnow >= deadline— only correct in the non-wrapping window. The verified core uses the wrapping-difference half-range test (now.wrapping_sub(deadline) < 2^63) that is genuinely wrap-safe, and is a strict superset of>=in the practical non-wrapping regime (proven). At u64-µs the wrap is ~584,000 years out, so this is not a behavior change for real values — it just makes the impl match its documented contract, with a proof.Kani (5/5,
cargo kani)deadline_total_and_zero_is_now—deadlinenever panics/overflows;deadline(now,0)==now.fresh_deadline_not_elapsed— a just-set deadline is not elapsed for any real (0 < ticks < 2^63) delay.at_deadline_is_elapsed—elapsed(d,d)is true.advanced_to_deadline_is_elapsed— oncenowadvances by the full delay, elapsed holds (wrap-safe across the domain).matches_plain_compare_without_wrap— agrees with>=whenever no wrap occurs.Oracles
cargo kanionos-time-math→ 5/5 SUCCESSFUL.time-providerstill builds forwasm32-unknown-unknown; the gale#214 provider drift gate stays green (8/8 crates).rivet validate→ PASS (333 warnings, no new diagnostics); addsVER-OS-TIME-MATH-001(verifiesREQ-OS-SYSCALL-001).Honest scope
Source-level proof over the pure math; the wasm→native dissolve of the provider remains differentially trusted, not proven equivalent (
docs/safety/verification-honesty.md). This is additional evidence, not a claim that the whole seam is now formally verified end-to-end.🤖 Generated with Claude Code