Skip to content

test: add property tests for settlement quorum logic - #305

Open
Jay989810 wants to merge 2 commits into
WHEELBACK:mainfrom
Jay989810:test/add-fuzz-style-property-tests-for-the-settlement-approval-quorum
Open

test: add property tests for settlement quorum logic#305
Jay989810 wants to merge 2 commits into
WHEELBACK:mainfrom
Jay989810:test/add-fuzz-style-property-tests-for-the-settlement-approval-quorum

Conversation

@Jay989810

Copy link
Copy Markdown

Closes #194

Description

This PR introduces property-based (fuzz-style) unit tests for the settlement approval and quorum execution logic using proptest. Rather than relying solely on static example-based tests, these property tests sweep randomized combinations of signer weight allocations, quorum thresholds, and approval subsets to ensure off-by-one, boundary, and threshold calculation bugs do not occur.

Proposed Changes

  • Dependency Configuration:
    • Added proptest = "1.4" to [dev-dependencies] in contracts/settlement/Cargo.toml and COMEBACKHERE-contracts/contracts/treasury/Cargo.toml.
    • Updated contracts/Cargo.toml workspace members to include "settlement".
  • Settlement Contract (comebackhere-settlement):
    • Added prop_settlement_quorum_logic in contracts/settlement/src/lib.rs.
    • Validates that accumulated signer approval weight incrementally matches expected sums across random signer weights (1..100) and threshold limits (1..500).
  • Treasury Contract (comebackhere-treasury):
    • Added prop_treasury_settlement_quorum_execution in COMEBACKHERE-contracts/contracts/treasury/src/integration_settlement_multisig.rs.
    • Asserts that execute_settlement succeeds (Ok(())) if and only if accumulated weight >= threshold, and fails with TreasuryError::InsufficientApprovals if accumulated weight < threshold.

Test Output

1. comebackhere-settlement Test Suite

$ cargo test --package comebackhere-settlement

running 7 tests
test tests::test_approve_not_found ... ok
test tests::test_approve_increments_weight_and_returns_threshold ... ok
test tests::test_approve_unauthorized_signer ... ok
test tests::test_approve_not_pending ... ok
test tests::test_approve_already_approved ... ok
test tests::test_multiple_signers_accumulate_weight ... ok
test tests::prop_settlement_quorum_logic ... ok

test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.91s

Add rustdoc/NatSpec-style comments to TreasuryContract public entrypoints, structs, enums, and error types.

- Document parameters, return values, and error conditions for all public functions
- Keep doc comments aligned with docs/contract-interaction-guide.md
- Update test setup and add unit tests for unpause, threshold, token allowlist, deposit, withdraw, and authorization checks
- Fix Cargo.lock derive_arbitrary dependency lock

Closes WHEELBACK#191
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@Jay989810 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

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 fuzz-style property tests for the settlement approval quorum

1 participant