Skip to content

Add leverage math property tests#128

Open
Sikkra wants to merge 1 commit into
Dgetsylver:mainfrom
Sikkra:bounty-50-leverage-proptests
Open

Add leverage math property tests#128
Sikkra wants to merge 1 commit into
Dgetsylver:mainfrom
Sikkra:bounty-50-leverage-proptests

Conversation

@Sikkra
Copy link
Copy Markdown

@Sikkra Sikkra commented May 19, 2026

Resolves #50.

Summary:

  • Added proptest coverage for leverage math with 1,000 cases per property.
  • Covered step borrow bounds, final-step no-borrow behavior, total supply/borrow equity preservation, leverage upper bound, health-factor monotonicity in collateral factor, and no-panic behavior on extreme inputs.
  • Changed loop_step_count to use saturating_add(1) so extreme u32 loop counts cannot overflow before the 21-step cap.

Verification:

  • $env:CARGO_TARGET_DIR = Join-Path $env:TEMP "codex-turbolong-blend-proptests"; cargo test --manifest-path contracts\strategies\blend_leverage\Cargo.toml -j 1 leverage_property_tests -- --nocapture
  • git diff --check

Note: using a target directory under %TEMP% avoids a Windows build-script failure seen when Cargo target artifacts are under the workspace path with spaces.

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.

D9: Property / invariant tests for leverage math

1 participant