MindBlockLabs/mindBlock_app
在 GitHub 查看Implement Sorted Leaderboard with Persistent Player Index
Open
#292 创建于 2026年3月18日
enhancementgood first issuesoroban
仓库指标
- Star
- (2 star)
- PR 合并指标
- (PR 指标待抓取)
描述
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