Repository navigation
Kobe API: Add jitosol_validators/:vote_account stake history endpoint - #66
Merged
Merged
Conversation
Per-validator, per-epoch JitoSOL stake-pool delegation in one call.
`jitosol_validators` already exposes `jito_sol_active_lamports`, but only
for every pool validator at a single epoch, so charting one validator's
history from a client means one request per epoch.
GET /api/v1/jitosol_validators/:vote_account?start_epoch=&end_epoch=
-> { vote_account, history: [{ epoch, jito_sol_active_lamports }] }
Reads the same `target_pool_active_lamports` the existing endpoint
serves, straight from the validator records (one doc per epoch per
validator), ascending by epoch. `jito_sol_active_lamports` is null for
epochs where the validator was not in the pool's validator list
(`target_pool_staked == false`). Invalid pubkey or inverted range -> 400.
Cached 60s per (vote_account, range) like the neighbouring wrappers.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
An inverted range just yields an empty history from Mongo, which is an honest 200; no need for a second validation branch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
CI note — the two red
|
There was a problem hiding this comment.
Pull request overview
Adds an API endpoint for retrieving one validator’s historical JitoSOL delegation by epoch.
Changes:
- Adds optional epoch-range filtering and ordered MongoDB retrieval.
- Adds request/response schemas, caching, resolver logic, handler, and route.
- Updates dependencies, audit exclusions, and boxes several large RPC errors.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
api/src/main.rs |
Registers the stake-history endpoint. |
api/src/schemas/validator.rs |
Defines request and response models. |
api/src/resolvers/query_resolver.rs |
Implements cached history resolution. |
api/src/resolvers/error.rs |
Boxes Jito transaction errors. |
core/src/db_models/validators.rs |
Adds the historical validator query. |
core/src/rpc_utils.rs |
Boxes RPC errors. |
cranker/src/utils.rs |
Boxes client errors. |
Cargo.lock |
Updates transitive dependencies. |
.cargo/audit.toml |
Adds ignored security advisories. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
aoikurokawa
approved these changes
Aug 25, 2026
ebatsell
approved these changes
Aug 25, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds
GET /api/v1/jitosol_validators/:vote_account— one validator's JitoSOL stake-pool delegation per epoch, in a single call.start_epoch/end_epochare optional and inclusive; omit both for the full history.jito_sol_active_lamportsis the sametarget_pool_active_lamportsthatjitosol_validatorsalready serves; it isnullfor epochs where the validator was not in the pool's validator list (target_pool_staked == false), so "not in pool" and "0 stake" stay distinguishable.start_epoch > end_epoch→ 400. Cached 60s per(vote_account, range)like the neighbouring wrappers.Why
jitosol_validatorsreturns every pool validator for a single epoch (~300KB), so charting one validator's history from jito.network means one request per epoch (see jito-labs/stake-pool-fe#917, which built a KV cache + backfill around that). This endpoint replaces that with one indexed read.Changes
core/src/db_models/validators.rs—ValidatorStore::find_by_vote_account(vote_account, start_epoch, end_epoch).api/src/schemas/validator.rs— request/response types.api/src/resolvers/query_resolver.rs—get_jitosol_validator_stake_history+#[cached]wrapper.api/src/main.rs— handler + route, next tovalidators/:vote_account.Ops note
The query filters on
vote_account(and optionallyepoch). The repo doesn't create indexes in code, so please make sure thevalidatorscollection has an index covering{ vote_account: 1, epoch: 1 }before/at deploy — without it this is a collection scan per cold request (~1.5k validators × ~420 epochs).Verification
cargo fmt --all --check,cargo clippy -p kobe-api -p kobe-core --all-features -- -D warnings,cargo check -p kobe-api— clean.find()/get_highest_epoch()in the same store.Refs MEV-12617.