api: top-attesters / top-schema-owners / top-attestor-sets leaderboards#67
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Grafana wants "who's using the chain most" panels — top attesters, top schema owners, top attestor sets — alongside the existing ops + cost + economy dashboards (chain v0.2.11). Prometheus is wrong for this (address labels = unbounded cardinality), so the data needs to live in the api with Grafana pointing at it via the Infinity HTTP-JSON datasource. Filed during the 2026-05-22 session as part of Track 4 "full cost metrics" closeout — leaderboards were the second half of that ask.
What
Three new endpoints, all read-only, all sourced from existing indexer tables:
GET /v1/stats/top-attesters?n=10attestationsGROUP BYsubmitterattestationsis small (devnet: ~20 rows)GET /v1/stats/top-schema-owners?n=10schemasGROUP BYownerschemasis tiny (devnet: ~8 rows)GET /v1/stats/top-attestor-sets?n=10attestor_setsORDER BYschema_count DESCschema_countis denormalised by ingest, no GROUP BYAll three return the same
LeaderboardResponseshape:{ "window": "all-time", "rows": [ {"rank": 1, "address": "lig1…", "count": 7}, {"rank": 2, "address": "lig1…", "count": 5}, … ] }Same
{rank, address, count}row shape across all three means Grafana table panels can use one template per leaderboard.addressislig1...for the first two (rollup addresses) andlas1...for top-attestor-sets (attestor-set ids) — same column, different identifier space, documented in the endpoint help.Query params:
ndefaults to 10, capped at 100. 30s in-process cache +Cache-Control: public, max-age=30matching the rest of/v1/stats/*.Followup
ops/grafana/ligate-node.jsononce the Grafana Infinity datasource is provisioned. Three table panels, one per leaderboard.?since=24h/?since=7d) that JOINs ontransactions.indexed_atfor "who's been most active this week." Response shape stays the same;windowfield changes from"all-time"to the requested interval.Net diff
3 files (
crates/api/src/stats.rs+204,crates/api/src/main.rs+5,CHANGELOG.md+5).