Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS-Team 2: Contracts & Harnesses for unchecked_add #91

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Yenyun035
Copy link

Towards #59

Changes

  • Added contracts for unchecked_add (located in library/core/src/num/int_macros.rs and uint_macros.rs)
  • Added a harness for unchecked_add of each integer type
    • i8, i16, i32, i64, i128, u8, u16, u32, u64, u128 --- 10 harnesses in total.

Revalidation

  1. Per the discussion in Challenge 11: Safety of Methods for Numeric Primitive Types #59, we have to build and run Kani from feature/verify-rust-std branch.
  2. To revalidate the verification results, run the following command. <harness_to_run> can be either num::verify to run all harnesses or num::verify::<harness_name> (e.g. check_unchecked_add_i8) to run a specific harness.
kani verify-std  "path/to/library" \
    --harness <harness_to_run> \
    -Z unstable-options \
    -Z function-contracts \
    -Z mem-predicates

All 10 harnesses should pass the same 1229 checks:

SUMMARY:
 ** 0 of 1229 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 2.4755886s

Complete - 10 successfully verified harnesses, 0 failures, 10 total.

Sidenotes

I ran rustfmt on mod.rs, int_macros.rs, and uint_macros.rs, so there might be format changes to existing code.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@Yenyun035 Yenyun035 requested a review from a team as a code owner September 20, 2024 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant