Skip to content

feat(scenarios): add support for Kamino programs - #5

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

feat(scenarios): add support for Kamino programs#5
bakasura980 wants to merge 2 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 scenario support across six Kamino programs and adds persistent overrides, indexed array paths, fixtures, templates, documentation, and an example liquidation scenario.

  • Registers Kamino Lend, Scope, Farms, Swap, Vault, and Liquidity templates.
  • Adds type-aware traversal and mutation of nested struct and array paths.
  • Re-applies overrides on later slots when persist is enabled.
  • Adds round-trip and targeted coverage for Kamino account forging.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
crates/types/src/scenarios.rs Adds persistent override metadata and resolves indexed paths to their terminal element type, completing the previously requested array-index fix.
crates/core/src/surfnet/svm.rs Integrates typed nested-path mutation and persistent scenario scheduling into account forging and slot processing.
crates/core/src/scenarios/registry.rs Registers the additional Kamino programs and adds broad path-validation and forging tests, including terminal array element resolution.
crates/core/src/scenarios/examples/kamino-liquidation-arbitrage.json Reworks the example to manipulate durable Scope and reserve inputs while preserving real DEX prices.
crates/sdk-node/surfpool-sdk/kit/generated/OverrideInstance.ts Exposes the optional persistent-override field in the generated Node SDK type.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Scenario override] --> B[Resolve template and account]
  B --> C[Resolve nested IDL path]
  C --> D[Convert JSON using terminal IDL type]
  D --> E[Mutate decoded account]
  E --> F[Borsh re-encode account]
  F --> G[Apply once or persist across slots]
Loading

Fix All in Greploop

Reviews (6): Last reviewed commit: "fix(scenarios): stop persisted overrides..." | Re-trigger Greptile

Comment thread crates/types/src/scenarios.rs Outdated
Comment thread crates/types/src/scenarios.rs Outdated
@failfmi failfmi changed the title Feat/kamino protocol support feat(scenarios): add support for Kamino programs Aug 12, 2026
Comment thread crates/types/src/scenarios.rs Outdated
Comment thread crates/types/src/scenarios.rs
Comment thread crates/core/src/surfnet/svm.rs Outdated
@bakasura980
bakasura980 force-pushed the feat/kamino-protocol-support branch from 557102b to 982f031 Compare August 13, 2026 09:32
…y slot

Addresses two review comments.

A persisted override was re-queued with fetch_before_use intact, so every
following slot pulled the whole account from mainnet again: one RPC per slot
per override, and any field the override does not write was reset to mainnet's
value, discarding what local transactions had written to it.

fetch_before_use is now cleared on the re-queue, but only after the write
succeeds, so a failed apply still retries next slot with the fetch. The
re-queue replaces a copy of itself already queued for that slot instead of
bailing out, which keeps one entry per id.

persist also gains the ts-bindings attribute its sibling fetch_before_use
already had, and the regenerated OverrideInstance.ts exposes it - the field
was previously absent from the TS SDK entirely.
@92Infinitus92

Copy link
Copy Markdown
Collaborator

The persisted re-fetch issue is fixed, but two different fetchBeforeUse overrides for the same account in one slot still fetch independently, so I believe the second drops the first change

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.

3 participants