Skip to content

test(common): add proptest suite for risk::collateral_value and ltv_bps monotonicity (#87) - #1141

Closed
jeffrey-graham wants to merge 1 commit into
DevTobis:mainfrom
jeffrey-graham:test/risk-proptest-monotonicity-87
Closed

jeffrey-graham wants to merge 1 commit into
DevTobis:mainfrom
jeffrey-graham:test/risk-proptest-monotonicity-87

Conversation

@jeffrey-graham

Copy link
Copy Markdown

Closes #87

Summary

  • Adds proptest (default-features = false, features = ["alloc"]) to [dev-dependencies] in contracts/common/Cargo.toml.
  • Adds a 256-case proptest! suite in contracts/common/src/risk.rs verifying:
    • collateral_value monotonicity in units and price, non-Increasing behavior in haircut.base_bps and haircut.fx_bps, zero output when total haircut is >= 10_000, and exact match with price when units == PRICE_SCALE and haircuts are 0.
    • ltv_bps monotonicity in debt, non-Increasing behavior in collateral_val, u32::MAX sentinel when collateral_val <= 0 && debt > 0, and 0 when debt <= 0.

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.

Add property tests for risk::collateral_value and ltv_bps monotonicity

1 participant