Skip to content

feat: add property-based tests for payout logic#469

Merged
Yunusabdul38 merged 1 commit intoWeb3Novalabs:mainfrom
EDOHWARES:feature/payout-property-tests
Mar 27, 2026
Merged

feat: add property-based tests for payout logic#469
Yunusabdul38 merged 1 commit intoWeb3Novalabs:mainfrom
EDOHWARES:feature/payout-property-tests

Conversation

@EDOHWARES
Copy link
Copy Markdown
Contributor

@EDOHWARES EDOHWARES commented Mar 27, 2026

Property-Based Testing for Payout Logic

Branch: feature/payout-property-tests
Issue Reference: #329

Description

This PR introduces property-based testing to the PrediFi payout logic using the proptest framework. By generating a wide range of stake and payout scenarios, we ensure that critical invariants of the protocol (such as fee calculation consistency and total stake conservation) are mathematically sound and resistant to edge cases.

Key Changes

  • Dependency Update: Added proptest to workspace Cargo.toml and contract dev-dependencies.
  • New Test Module: Created src/payout_proptests.rs which verifies:
    • winnings + protocol_fee <= total_stake across all input ranges.
    • Payout stability for winners and non-winners.
    • Consistency of SafeMath share calculations with varying precision.
  • Module Registration: Registered the new test module in lib.rs under its own cfg(test) block.

Verification Results

  • Ran cargo test payout_proptests with 100+ randomized iterations.
  • Confirmed that no arithmetic overflows or rounding errors violate protocol invariants.

Closes #329

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

@EDOHWARES is attempting to deploy a commit to the shola's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@EDOHWARES Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@EDOHWARES
Copy link
Copy Markdown
Contributor Author

@Yunusabdul38 , pls review

@Yunusabdul38 Yunusabdul38 merged commit fd365cf into Web3Novalabs:main Mar 27, 2026
1 of 2 checks passed
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.

Create Property-Based Tests for Payout Logic

2 participants