Skip to content

Feat/kamino protocol support - #5

Open
bakasura980 wants to merge 5 commits into
developfrom
feat/kamino-protocol-support
Open

Feat/kamino protocol support#5
bakasura980 wants to merge 5 commits into
developfrom
feat/kamino-protocol-support

Conversation

@bakasura980

@bakasura980 bakasura980 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

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.

  • Registers six Kamino programs with bundled IDLs, templates, fixtures, and documentation.
  • Extends scenario execution with persistent override scheduling.
  • Adds dot-notation traversal for nested structs and array elements.

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

Filename Overview
crates/types/src/scenarios.rs Adds persistence metadata and IDL path resolution, but terminal array indices still return their containing array type.
crates/core/src/surfnet/svm.rs Adds persistent override scheduling and consumes resolved field types during account forging.
crates/core/src/scenarios/registry.rs Registers the expanded Kamino protocol templates and adds round-trip coverage for nested indexed paths.
crates/core/src/scenarios/protocols/kamino/scope/v1/overrides.yaml Adds Scope templates, including a terminal indexed Pubkey property affected by the unresolved type-resolution defect.

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]
Loading

Fix All in Claude Code Fix All in Codex Fix All in Cursor

Prompt To Fix All With AI
### Issue 1
crates/types/src/scenarios.rs:1012-1021
**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.

Reviews (2): Last reviewed commit: "Reduce persist prop description" | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

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 thread crates/types/src/scenarios.rs
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Fix in Claude Code Fix in Codex Fix in Cursor

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.

1 participant