Skip to content

feat(tests): add property-based tests for mathematical invariants#200

Merged
Mosas2000 merged 1 commit intomainfrom
fix/add-property-based-tests
Mar 26, 2026
Merged

feat(tests): add property-based tests for mathematical invariants#200
Mosas2000 merged 1 commit intomainfrom
fix/add-property-based-tests

Conversation

@Mosas2000
Copy link
Copy Markdown
Owner

Add 36 property-based tests validating contract mathematical invariants:

  • Quadratic voting costs
  • Stake accumulation and isolation
  • Proposal counting and ID sequence
  • Vote counting and execution state
  • Minimum stake and outcome rules

Resolves #56

Add 36 tests validating contract mathematical properties:
- Quadratic voting cost invariant (cost = weight^2) for 12 weight values
- Quadratic cost boundary validation (exact threshold testing)
- Stake accumulation invariant (deposits sum correctly)
- Stake isolation invariant (independent user balances)
- Proposal count invariant (count equals number of proposals)
- Proposal ID invariant (sequential IDs starting from 0)
- Vote count invariant (accumulation across voters)
- Execution state invariant (executed stays executed)
- Minimum stake invariant (10 STX requirement)
- Vote outcome invariant (votes-for > votes-against required)

Resolves #56
@Mosas2000 Mosas2000 merged commit 79ff158 into main Mar 26, 2026
14 of 25 checks passed
@Mosas2000 Mosas2000 deleted the fix/add-property-based-tests branch March 26, 2026 16:25
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.

Testing: Add property-based tests for mathematical invariants

1 participant