Skip to content

feat(api): attester duties, committees, and bulk validator status endpoints - #823

Merged
pk910 merged 3 commits into
masterfrom
pk910/slashoor-api
Aug 6, 2026
Merged

feat(api): attester duties, committees, and bulk validator status endpoints#823
pk910 merged 3 commits into
masterfrom
pk910/slashoor-api

Conversation

@pk910

@pk910 pk910 commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Adds three general-purpose read-only API endpoints that surface data Dora already computes internally, so external tools (validator monitors, slashers, staking dashboards) can resolve attester committees and validator status without a beacon node.

New endpoints

Route Methods Cost Description
/api/v1/epoch/{epoch}/duties GET 2 Attester committees per slot for an epoch, as global validator indices
/api/v1/slot/{slot}/committees GET 1 Attester committees for a single slot (optional ?committee=0,1,2 filter)
/api/v1/validators/status GET, POST 2 Bulk validator status (up to 10k indices; ?indices= or {"indices":[...]})

Also adds slashed and withdrawable_epoch to GET /api/v1/validators (APIValidatorInfo).

Details

  • Committees resolved via ChainService.GetSlotCommittees — in-memory epoch stats with a blockdb fallback for finalized epochs. No beacon-node call; Dora computes the shuffling locally.
  • epoch/{epoch}/duties returns 404 only when all slots lack duties, so callers can distinguish "no data" from "empty". Future epochs beyond currentEpoch+1 return 400.
  • validators/status caps at 10,000 indices; missing indices are omitted. Status derived as in validator_v1.go.
  • Routes registered in startApi with call costs and OPTIONS; swaggo annotations added and docs/ regenerated via make api-docs.

Motivation

These back the slashoor slasher (which uses Dora as its durable block/duty store), but each is a standalone general-audience explorer API.

Checks

go build, go vet, gofmt -s, and golangci-lint run --new-from-rev=origin/master all pass.

pk910 added 2 commits August 6, 2026 16:01
… endpoints

Add three general-purpose read APIs that expose data Dora already computes
internally, so external tools can resolve attester committees and validator
status without a beacon node:

- GET /api/v1/epoch/{epoch}/duties      - attester committees per slot for an epoch
- GET /api/v1/slot/{slot}/committees    - attester committees for a single slot
- GET|POST /api/v1/validators/status    - bulk validator status (up to 10k indices)

Also expose `slashed` and `withdrawable_epoch` on GET /api/v1/validators.

Committees are served from in-memory epoch stats with a blockdb fallback (no
beacon-node call). Duties return 404 when unavailable for an epoch so callers
can distinguish "no data" from "empty". Swagger regenerated.
APIEpochDutiesV1 called GetSlotCommittees for every slot in the epoch. On the
blockdb/S3 fallback path each of those calls loads the entire epoch duties
object, so a full epoch reloaded the same object once per slot (32x on mainnet).

Add ChainService.GetEpochCommittees(epoch), which resolves committees for all
slots from a single source read (in-memory epoch stats, or one blockdb
GetEpochDuties fetch), and switch the handler to it.
@pk910
pk910 enabled auto-merge August 6, 2026 15:51
@pk910
pk910 disabled auto-merge August 6, 2026 16:09
@pk910
pk910 merged commit eddb9b5 into master Aug 6, 2026
3 of 6 checks passed
@pk910
pk910 deleted the pk910/slashoor-api branch August 6, 2026 16:43
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.

2 participants