Kobe API: Read jitosol_validators/:vote_account history through a projection - #67
Open
ggnine-jito wants to merge 1 commit into
Open
Kobe API: Read jitosol_validators/:vote_account history through a projection#67ggnine-jito wants to merge 1 commit into
jitosol_validators/:vote_account history through a projection#67ggnine-jito wants to merge 1 commit into
Conversation
The unbounded request 500'd in production: the validators collection still holds records from before the current `Validator` fields existed, and `try_collect::<Vec<Validator>>()` fails on the first one (`find()` never hits this because it only reads the two newest epochs; the same reason `jitosol_validators` 500s for epoch 598). Project just `epoch` / `target_pool_active_lamports` / `target_pool_staked` into `ValidatorPoolStake` with serde defaults, so those epochs read as "not in pool" (null) instead of failing the query. Also trims what Mongo sends back to the three fields actually used. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Follow-up to #66. In production the unbounded request (
/api/v1/jitosol_validators/:vote_accountwith no epoch range) returns 500, while any range from epoch 599 on works:The
validatorscollection still holds records older than ~epoch 598 written before the currentValidatorfields existed, andtry_collect::<Vec<Validator>>()fails on the first one.find()never trips on this because it only reads the two newest epochs — it's the same reasonjitosol_validators500s for epoch 598.Fix
Read this query through a 3-field projection (
epoch,target_pool_active_lamports,target_pool_staked) into a smallValidatorPoolStakestruct with serde defaults. Old records deserialize and read as "not in pool" (null), and Mongo returns three fields per doc instead of ~40. Response shape is unchanged.Verification
cargo fmt --all --check,cargo clippy -p kobe-api -p kobe-core --all-features -- -D warnings,cargo check -p kobe-api— clean.3N7s9zXMZ4QqvHQR15t5GNHyqc89KduzMP7423eWiD5gand6hkfqeNAbURk7CmAQsP4Qm6WwHVF4LxHupEvQf7Tkrf1(currently 500).Refs MEV-12617, jito-labs/stake-pool-fe#919.