Summary
leaderboard/src/lib.rs get_rank returns 0 for any address not in the top-50 list. A return value of 0 is indistinguishable from "rank 0" (the first position), making it impossible to tell whether a player is ranked first or not ranked at all.
Impact
Fix
Return UNRANKED_RANK (51) for any player not in the top-50, ensuring rank > MAX_TOP_PLAYERS is the sole marker for "not ranked".
Reproduction
- Query
get_rank for an address that has never played.
- Observe the return value
0.
- Compare with
get_top_players()[0] — the first entry has rank 1, so 0 appears to be ahead of rank 1.
Summary
leaderboard/src/lib.rsget_rankreturns0for any address not in the top-50 list. A return value of0is indistinguishable from "rank 0" (the first position), making it impossible to tell whether a player is ranked first or not ranked at all.Impact
UNRANKED_RANKconstant, line 17), which reserves values> MAX_TOP_PLAYERSfor unranked players.Fix
Return
UNRANKED_RANK(51) for any player not in the top-50, ensuringrank > MAX_TOP_PLAYERSis the sole marker for "not ranked".Reproduction
get_rankfor an address that has never played.0.get_top_players()[0]— the first entry has rank 1, so0appears to be ahead of rank 1.