Skip to content

feat(stats): add bounded on-chain leaderboard queries#236

Merged
josephchimebuka merged 7 commits into
TevaLabs:mainfrom
Oyinkans0la12:feat/leaderboard-api
Jul 2, 2026
Merged

feat(stats): add bounded on-chain leaderboard queries#236
josephchimebuka merged 7 commits into
TevaLabs:mainfrom
Oyinkans0la12:feat/leaderboard-api

Conversation

@Oyinkans0la12

Copy link
Copy Markdown
Contributor

Closes #194

Summary

Add bounded on-chain leaderboard APIs for wins and best streak with deterministic pagination.

Changes

  • Added leaderboard entry type
  • Added bounded leaderboard index maintenance
  • Added paginated leaderboard query endpoints
  • Implemented deterministic tie-breaking
  • Added test coverage for pagination, ordering, and consistency

Ordering

Primary sort:

  • Wins (or Best Streak)

Tie-breaking:

  • Deterministic using existing stable project identifiers

This guarantees stable pagination across repeated queries.

Storage

The leaderboard index is maintained as a bounded collection to prevent unbounded contract storage growth.

Testing

Covered:

  • Wins leaderboard
  • Best streak leaderboard
  • Multi-page pagination
  • Stable tie-breaking
  • Leaderboard updates after stat changes
  • Bounded storage behavior
  • Consistency with per-user statistics

Validation

Executed:

cargo test -p <affected-crate>
cargo clippy --workspace --all-targets -- -D warnings
cargo build --target wasm32-unknown-unknown --release

Scope

This PR intentionally focuses only on bounded leaderboard indexing and paginated read APIs. It does not redesign the statistics system, storage architecture, ranking engine, or introduce off-chain indexing.

@josephchimebuka

Copy link
Copy Markdown
Contributor

@Oyinkans0la12 Please fix conflicts

@Oyinkans0la12

Copy link
Copy Markdown
Contributor Author

@Oyinkans0la12 Please fix conflicts

Resolved already, thanks!

@Oyinkans0la12

Copy link
Copy Markdown
Contributor Author

Conflicts resolved, please merge.

@josephchimebuka josephchimebuka merged commit 53225e9 into TevaLabs:main Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Leaderboard API: add paginated top users by wins and best streak

2 participants