MindBlockLabs/mindBlock_app
GitHub で見るImplement Sorted Leaderboard with Persistent Player Index
Open
#292 opened on 2026年3月18日
enhancementgood first issuesoroban
Repository metrics
- Stars
- (2 stars)
- PR merge metrics
- (PR metrics pending)
説明
Description:
The get_leaderboard() function currently returns an empty vector and serves as a placeholder. This needs to be fully implemented to support the game's social competition features.
Current Behavior:
get_leaderboard() accepts a limit: u32 parameter but always returns an empty Vec regardless of registered players or their XP. Expected Behavior: The function should return the top N players (where N = limit) sorted by XP in descending order.
Requirements:
- Maintain a registry of all player addresses whenever a new player registers
- The leaderboard query should respect the limit parameter
- Players should be ranked by their current XP value
- The implementation must work within Soroban's storage constraints — note that iterating all storage keys directly is not supported on Soroban; a separate index structure must be maintained
Acceptance Criteria:
- get_leaderboard(5) returns the top 5 players by XP
- Results are sorted highest XP first
- A new player registration updates the player index
- A test covering leaderboard ordering is included