test: add proptest invariants for VotingManager stake conservation (#607)#638
Open
Jonahadukwu5 wants to merge 1 commit into
Open
test: add proptest invariants for VotingManager stake conservation (#607)#638Jonahadukwu5 wants to merge 1 commit into
Jonahadukwu5 wants to merge 1 commit into
Conversation
- Add voting_invariants.rs with 5 proptest suites (1000 cases each) - Assert sum(outcome_distribution) == total_staked after every vote - Covers: sequential votes, multi-outcome, duplicate-user guard, zero-stake, large voter sets (50-200 voters) - Deterministic seed via source_file in ProptestConfig - Fix pre-existing require_auth_coverage_tests.rs build errors (missing max_deviation_bps arg in 4 calls) Closes Predictify-org#607
|
@Jonahadukwu5 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 #607
Summary
Implements issue #607. Adds a proptest harness that asserts the global stake conservation invariant after every sequence of valid votes:
Changes
contracts/predictify-hybrid/src/voting_invariants.rs— 5 proptest suites (1000 cases each, deterministic seed)src/lib.rs— register#[cfg(test)] mod voting_invariantsrequire_auth_coverage_tests.rs— 4 pre-existing build errors (missingmax_deviation_bpsarg)Test suites
prop_sequential_votes_conserve_stakeprop_multi_outcome_distribution_conserves_stakeprop_duplicate_user_stake_not_silently_doubledAlreadyVotedguard is load-bearingprop_zero_stake_does_not_corrupt_totalprop_large_voter_set_conserves_stakeTest output
Acceptance criteria
stake1=1_000_000, stake2=1_000_000)source_fileinProptestConfigunwrap()added to production code