Skip to content

feat: add player match indexing and pagination support#708

Merged
famvilianity-eng merged 6 commits into
StellarCheckMate:mainfrom
benjaminjohnsonfin-afk:feat/add-pagination-tests
May 30, 2026
Merged

feat: add player match indexing and pagination support#708
famvilianity-eng merged 6 commits into
StellarCheckMate:mainfrom
benjaminjohnsonfin-afk:feat/add-pagination-tests

Conversation

@benjaminjohnsonfin-afk
Copy link
Copy Markdown
Contributor

@benjaminjohnsonfin-afk benjaminjohnsonfin-afk commented May 30, 2026

Implements player match indexing and pagination support for the Checkmate-Escrow contract. Adds two new public getter functions (get_match_count() and get_player_matches()) and comprehensive test coverage for pagination boundaries, insertion order preservation, and player data isolation.

Related Issues

Changes

  • Added get_match_count() function to return total number of matches created
  • Added get_player_matches(player) function to return all match IDs for a player
  • Updated create_match() to append match ID to both players' match indices
  • Added PlayerMatches(Address) and OracleRecord(u64) variants to DataKey enum
  • Added comprehensive test coverage for all pagination scenarios

Tests Added

  • test_get_match_count_increments_correctly
  • test_get_player_matches_preserves_insertion_order
  • test_player_history_index_excludes_unrelated_matches
  • test_player_match_pagination_handles_empty_and_partial_pages

Closes #577
Closes #578
Closes #579
Closes #580

- Adds get_match_count() function to return total number of matches created
- Updates DataKey enum to include PlayerMatches and OracleRecord variants
- Increments match count on each create_match call
- Verifies match count starts at 0
- Asserts count increments after each create_match call
- Tests multiple sequential creations
- Creates multiple matches for the same player
- Verifies returned match IDs maintain insertion order
- Ensures stable ordering for frontend pagination
- Creates separate matches for different player pairs
- Verifies each player only sees their own match IDs
- Ensures no data leakage between player indices
…pages

- Creates 25 matches to test pagination boundaries
- Verifies all match IDs are returned in order
- Tests empty result set for players with no matches
- Ensures pagination handles partial pages correctly
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@benjaminjohnsonfin-afk 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

@famvilianity-eng famvilianity-eng merged commit 498a158 into StellarCheckMate:main May 30, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants