Repository navigation
Conversation
r-near
marked this pull request as ready for review
October 28, 2026 17:00
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the contract-clause depth helper changes.
No open issues 🎉
What changed in this PR
This PR removes saturating method calls from Kani’s contract-clause depth helpers to avoid CBMC’s “not enough arguments” warning during function-contract verification. It addresses a related helper issue, not the broader loop-invariant method-call problem in #4796.
Changes:
- Replace saturating calls with bounds-checked arithmetic, preserving saturation behavior.
- Add a regression test requiring successful verification without missing-argument warnings.
- Update two expected check counts for the added overflow checks.
| File | Description |
|---|---|
library/kani_core/src/lib.rs |
Use guarded increments and decrements for contract-clause depth. |
tests/script-based-pre/contract_clause_write_set/write_set.sh |
Check verification succeeds without missing-argument warnings. |
tests/script-based-pre/contract_clause_write_set/write_set.expected |
Define the regression test’s success output. |
tests/script-based-pre/contract_clause_write_set/fixture.rs |
Provide a function-contract proof fixture. |
tests/script-based-pre/contract_clause_write_set/config.yml |
Register the regression script and expected output. |
tests/expected/function-contract/capture_load_user_deref_pass.expected |
Increase the expected check count from 58 to 60. |
tests/expected/function-contract/capture_load_checks_elided.expected |
Increase the expected check count from 34 to 36. |
Review effort: Balanced
This branch has not been deployed
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.
__VERIFIER_kani_{enter,exit}_contract_clausearen't instrumented by DFCC but calledsaturating_add/saturating_sub, which are, so everyproof_for_contractharness printed CBMC's "not enough arguments" warning. This replaces the calls with a bounds-checked+ 1/- 1. The twocapture_load_*check counts go up by 2 for the new overflow checks.Adds
tests/script-based-pre/contract_clause_write_set, which fails before this change.Related to #4796
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.