test: add property tests for settlement quorum logic - #305
Open
Jay989810 wants to merge 2 commits into
Open
Conversation
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
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
proptest = "1.4"to[dev-dependencies]incontracts/settlement/Cargo.tomlandCOMEBACKHERE-contracts/contracts/treasury/Cargo.toml.contracts/Cargo.tomlworkspace members to include"settlement".comebackhere-settlement):prop_settlement_quorum_logicincontracts/settlement/src/lib.rs.comebackhere-treasury):prop_treasury_settlement_quorum_executioninCOMEBACKHERE-contracts/contracts/treasury/src/integration_settlement_multisig.rs.execute_settlementsucceeds (Ok(())) if and only if accumulated weight >= threshold, and fails withTreasuryError::InsufficientApprovalsif accumulated weight < threshold.Test Output
1.
comebackhere-settlementTest Suite