test: add comprehensive tests for resolution delay and dispute window#287
Merged
greatest0fallt1me merged 3 commits intoPredictify-org:masterfrom Jan 31, 2026
Conversation
Contributor
Author
|
Thank you for your efforts, pls kindly give me some compliments |
…ed conflict in lib.rs
… both test modules
Contributor
Author
|
conflict resolved, kindly merge |
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.
Summary
This pull request adds comprehensive test coverage for the resolution delay and dispute window functionality in the Predictify Hybrid contract. The tests verify that:
Test Coverage
Added 15 comprehensive tests in
resolution_delay_dispute_window_tests.rs:Payout Blocking Tests (3 tests)
test_payout_blocked_during_dispute_window- Verifies payouts are blocked during active dispute windowtest_payout_allowed_after_dispute_window_closes- Confirms payouts work after window expirestest_payout_blocked_with_active_dispute- Tests payout blocking with disputed market stateDispute Creation Tests (2 tests)
test_dispute_creation_during_window- Validates dispute creation within allowed timeframetest_dispute_extends_market_deadline- Confirms dispute filing extends market deadline by configured hoursPer-Event vs Global Window Tests (2 tests)
test_per_event_dispute_window- Verifies each market has independent dispute windowstest_global_dispute_extension_constant- Confirms global constant is properly configured (24 hours default)Edge Case Tests (5 tests)
test_zero_dispute_window_not_allowed- Ensures dispute window cannot be zerotest_very_long_dispute_window- Tests extended dispute windows (168 hours / 1 week)test_exact_timestamp_match_at_window_boundary- Validates behavior at exact boundary timestampstest_dispute_window_boundary_exact_expiry- Tests exact dispute window expirationtest_multiple_disputes_extend_once- Verifies multiple users can add dispute stakes and extension logicResolution Delay Tests (2 tests)
test_resolution_blocked_before_end_time- Confirms markets cannot be resolved before end timetest_resolution_allowed_after_end_time- Validates resolution is allowed after end timeFull Lifecycle Test (1 test)
test_full_lifecycle_with_dispute_window- Complete integration test covering:Implementation Details
soroban_sdk::testutilsfor ledger timestamp mockingTestSetuphelper struct for consistent test environmentEndedbefore filing disputes (per state machine requirements)env.ledger().timestamp()DISPUTE_EXTENSION_HOURSconstant (24 hours default)Test Results
Full test suite: 468 tests passed (including the 15 new tests)
Coverage Analysis
The new tests achieve comprehensive coverage of:
Estimated coverage: >95% of resolution delay and dispute window functionality
Files Changed
contracts/predictify-hybrid/src/resolution_delay_dispute_window_tests.rs(new file, 500+ lines)contracts/predictify-hybrid/src/lib.rs(added module declaration)Notes
Closes #264