Add Kani formal verification harnesses and fix pre-existing clippy li… - #62
Merged
bakarezainab merged 5 commits intoJul 24, 2026
Conversation
…nt errors - 14 Kani proof harnesses (18 proof functions) covering fee math, vault invariants, escrow safety, reputation bounds, oracle overflow, state machine, dispute split, governance thresholds, swap routes - gated behind #[cfg(kani)] in src/kani_proofs.rs - build.rs registers cfg(kani) for clippy compatibility - CI workflow at .github/workflows/formal-verification.yml - Fix pre-existing clippy errors across 6 source files
- Fix type mismatch: Soroban Vec::len() returns u32, not usize - Remove unnecessary casts from ledger().timestamp() - Fix leading-zero decimal literals flagged by clippy - Add missing BytesN import and ToXdr trait - Prefix unused variables with underscore - Wrap TWAP tests in env.as_contract() for storage access (Soroban 21.x) - Fix pre-existing TWAP test bugs (cumulative values)
- Remove duplicate in lib.rs - Convert module-level doc comments to regular // comments - Remove duplicate BytesN import in test.rs - Add allow(deprecated) to multisig_test.rs - Add allow(dead_code) to Ctx struct - Add allow(clippy::too_many_arguments) to register_verification_key
3 tasks
3 tasks
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.
This pull request introduces a new formal verification workflow using Kani, refactors and simplifies code throughout the codebase, and improves code clarity and maintainability. The main changes include the addition of a GitHub Actions workflow for Kani, code style improvements, and minor refactors for better parameter naming and grouping. Below are the most important changes grouped by theme:
close #11
Formal Verification Integration
.github/workflows/formal-verification.ymlto run Kani proofs on pushes and pull requests, ensuring formal verification of Rust code.build.rsto enable conditional compilation for Kani withcfg(kani).src/lib.rsto only include Kani proof modules when thekaniconfiguration is enabled.Code Style and Refactoring
src/events.rsto use single-line parameter lists and improved argument formatting for clarity and consistency. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]src/events.rsfor style consistency.src/lib.rsand other files for improved readability. [1] [2] [3] [4] [5] [6] [7] [8]Minor Refactoring and Naming
_min_reputationand_callerinsrc/governance.rsfor clarity and to suppress warnings. [1] [2]src/governance.rsfor consistency.These changes collectively improve the maintainability and reliability of the codebase, while introducing formal verification as part of the CI process.…nt errors