Feat/kamino protocol support - #5
Open
bakasura980 wants to merge 5 commits into
Open
Conversation
Adds override templates for every Kamino product: Lend (klend), Scope, Farms, Swap (LIMO), Earn (kvault) and Liquidity (kliquidity) - 36 templates in total, up from 3. - upgrade the klend IDL from v1.12.6 to v1.23.0 (fetched from mainnet) - add IDLs and templates for the five previously unsupported programs - support array-index paths in override values (deposits.0.deposited_amount) - fix pubkey override values being parsed as hex when they are all-hex base58 - add an opt-in `persist` flag so an override can outlive a single slot - add six real mainnet account fixtures and round-trip tests over them - rewrite the liquidation-arbitrage example against verified live state
Adds override templates for every Kamino product: Lend (klend), Scope, Farms, Swap (LIMO), Earn (kvault) and Liquidity (kliquidity) - 36 templates in total, up from 3. - upgrade the klend IDL from v1.12.6 to v1.23.0 (fetched from mainnet) - add IDLs and templates for the five previously unsupported programs - support array-index paths in override values (deposits.0.deposited_amount) - fix pubkey override values being parsed as hex when they are all-hex base58 - add an opt-in `persist` flag so an override can outlive a single slot - add six real mainnet account fixtures and round-trip tests over them - rewrite the liquidation-arbitrage example against verified live state
Adds override templates for every Kamino product: Lend (klend), Scope, Farms, Swap (LIMO), Earn (kvault) and Liquidity (kliquidity) - 36 templates in total, up from 3. - upgrade the klend IDL from v1.12.6 to v1.23.0 (fetched from mainnet) - add IDLs and templates for the five previously unsupported programs - support array-index paths in override values (deposits.0.deposited_amount) - fix pubkey override values being parsed as hex when they are all-hex base58 - add an opt-in `persist` flag so an override can outlive a single slot - add six real mainnet account fixtures and round-trip tests over them - rewrite the liquidation-arbitrage example against verified live state
Comment on lines
+1012
to
+1021
| Ok(field) | ||
| } | ||
|
|
||
| /// The IDL type at a dot-notation property path. | ||
| pub fn resolve_idl_type<'a>( | ||
| idl: &'a Idl, | ||
| account_type: &str, | ||
| path: &str, | ||
| ) -> Result<&'a anchor_lang_idl::types::IdlType, String> { | ||
| resolve_idl_field(idl, account_type, path).map(|field| &field.ty) |
There was a problem hiding this comment.
Terminal array index stays unresolved
When an override path ends at an array index such as price_info_accounts.0, traversal advances only the local ty reference but returns the containing field, so resolve_idl_type reports the array instead of the selected Pubkey. The forging path consequently performs conversion using the wrong IDL type, leaving the Kamino Scope price-source override unable to re-encode correctly.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/types/src/scenarios.rs
Line: 1012-1021
Comment:
**Terminal array index stays unresolved**
When an override path ends at an array index such as `price_info_accounts.0`, traversal advances only the local `ty` reference but returns the containing `field`, so `resolve_idl_type` reports the array instead of the selected `Pubkey`. The forging path consequently performs conversion using the wrong IDL type, leaving the Kamino Scope price-source override unable to re-encode correctly.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
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.
Greptile Summary
The PR expands native Kamino scenario support across lending, Scope, Farms, Swap, Earn vaults, and Liquidity, while adding persistent overrides and indexed field-path handling.
Confidence Score: 4/5
The PR is not yet safe to merge because terminal array-index overrides still resolve to the wrong IDL type and can break Kamino Scope account forging.
The attempted resolver fix advances a local type through an array index but returns the original containing field type, leaving the previously reported terminal-index failure reachable for
price_info_accounts.0.Files Needing Attention: crates/types/src/scenarios.rs and crates/core/src/scenarios/protocols/kamino/scope/v1/overrides.yaml
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Scenario property path] --> B[resolve_idl_type] B --> C[Convert JSON override] C --> D[Write decoded account field] D --> E[Borsh re-encode account]Prompt To Fix All With AI
Reviews (2): Last reviewed commit: "Reduce persist prop description" | Re-trigger Greptile