MindBlockLabs/mindBlock_app

Implement Sorted Leaderboard with Persistent Player Index

Open

#292 aperta il 18 mar 2026

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)TypeScript (78 fork)auto 404
enhancementgood first issuesoroban

Metriche repository

Star
 (2 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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

Guida contributor