feat:Issue 866 add coverage badge#994
Open
Happybello365 wants to merge 123 commits into
Open
Conversation
- Add AllowedToken(Address) to DataKey enum - Add TokenNotAllowed and TokenAlreadyAllowed errors - Implement add_allowed_token() and remove_allowed_token() admin functions - Add is_token_allowed() query function - Validate token in create_match() against allowlist - Add comprehensive tests for token allowlist functionality Fixes StellarCheckMate#52
- Added client.add_allowed_token(&token_addr) in setup() function - This fixes CI failures where tests failed because create_match now requires tokens to be in the allowlist (PR StellarCheckMate#89)
…rCheckMate#52) - Add DataKey::AllowedToken(Address) variant to DataKey enum - Add Error::TokenNotAllowed = 11 to the Error enum - Add admin functions: add_allowed_token, remove_allowed_token, is_allowed_token - Reject create_match if the token is not on the admin-managed allowlist - Update setup() helper to register the test token as allowed - Add 6 new tests covering allowed/disallowed token scenarios and non-admin access control for allowlist management
…e#65) - test_player1_cannot_deposit_twice: player1 deposits successfully then calls deposit again, asserts Error::AlreadyFunded - test_player2_cannot_deposit_twice: same coverage for player2
…the-oracle-before-state-check
…leted instead of InvalidState - errors.rs: add MatchCancelled=11, MatchCompleted=12 (HEAD) merged with MatchNotExpired=13, InvalidGameId=14 (origin/main) — all sequential - deposit() already had explicit guards for Cancelled and Completed states; merge conflict resolved keeping those checks intact - tests: add test_deposit_into_cancelled_match_returns_match_cancelled and test_deposit_into_completed_match_returns_match_completed - update two stale origin/main assertions that expected InvalidState to now correctly expect MatchCancelled / MatchCompleted All 52 tests pass.
…submit_result Replace unchecked multiplication with checked_mul(2).ok_or(Error::Overflow)? to safely handle stake amounts near i128::MAX / 2. Add test to verify Overflow error is returned for large stake amounts.
…stake (StellarCheckMate#169) - Replace with in submit_result - Add test_create_match_with_max_stake_amount: verifies create_match succeeds with i128::MAX and submit_result returns Error::Overflow when pot calculation overflows
… submit_result Closes StellarCheckMate#144 The existing test_ttl_extended_on_submit_result covered Winner::Player2. Added two explicit tests to cover the remaining paths: - test_ttl_extended_on_submit_result_player1_wins - test_ttl_extended_on_submit_result_draw All three Winner variants now have dedicated TTL extension assertions.
…test/unpause-restores-create-match test: verify unpause restores create_match functionality
…test feat: oracle.get_result on non-existent match_id should return Result…
feat: implement player match indexing and get_player_matches getter
…it-result-pot-overflow Fix StellarCheckMate#170: use checked_mul to prevent pot overflow in submit_result
…-169-overflow-guard-max-stake feat: add overflow guard for pot calculation and test with i128::MAX …
…-174-is-initialized feat: add is_initialized() helper and test (StellarCheckMate#174)
…-137-state-transition-pending-active test: explicitly assert Pending -> Active state transition (StellarCheckMate#137)
…e-181-test-oracle-submit_result feat: Add Test: oracle submit_result is blocked when oracle contract …
…e-187-match-never-existed feat: distinguish MatchNotFound vs MatchStorageExpired
…ow-state-test feat(testing): add escrow state transition tests for all winner variants
…yer1-balance feat: add player1 balance test
fix feature add result
…paused-getter fix(StellarCheckMate#139): add is_paused getter and test
…cle-get-admin fix(StellarCheckMate#135): add get_admin getter to oracle contract and test
…me-id-mismatch fix: validate game_id against escrow match in oracle submit_result
…ame-player-match fix: reject create_match when player1 == player2
…tended-on-submit-result tests: extend TTL coverage on submit_result for Player2Wins and Draw
…ntract-token-balance-zero-after-winner-payout fix: resolve contract token balance zero after winner payout
Contributor
|
please resolve conflict |
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
Provide a short description of the change and the problem it fixes.
Related Issue
Link the issue number or task this PR addresses.
What changed
Verification
cargo test -p escrowcargo test -p oraclecargo fmtcargo clippyChecklist
Notes
Add any additional details, risks, or follow-up tasks here.
closes #866