Skip to content

feat: add BisonFi override templates - #8

Open
bakasura980 wants to merge 37 commits into
feat/scenarios/protocols/kaminofrom
feat/bisonfi-support
Open

feat: add BisonFi override templates#8
bakasura980 wants to merge 37 commits into
feat/scenarios/protocols/kaminofrom
feat/bisonfi-support

Conversation

@bakasura980

@bakasura980 bakasura980 commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

BisonFi publishes no IDL and is not an Anchor program, so this adds a raw byte-layout write path guarded by account size and magic, plus four templates on it: price, depth, spread and freshness.

Also introduces optional IDLs on templates, so a program without one no longer needs a reconstructed IDL in the repo.

Greptile Summary

The PR adds IDL-free, guarded raw-byte account overrides and four BisonFi scenario templates.

  • Adds exact-size and magic/version validation before raw account writes.
  • Supports integer, strided, public-key, and slot-relative raw encodings.
  • Registers BisonFi templates without requiring a reconstructed Anchor IDL.
  • Adds extensive BisonFi integration coverage and scenario documentation.
  • Adds an automated OpenAI review workflow.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the eligible follow-up scope.

No blocking failure remains.

Important Files Changed

Filename Overview
crates/types/src/scenarios.rs Adds optional template IDLs and guarded raw-layout encoding, validation, and materialization contracts.
crates/core/src/surfnet/svm.rs Routes raw-layout templates through guarded byte writes while retaining the existing IDL-backed path.
crates/core/src/scenarios/registry.rs Registers the four BisonFi templates without an IDL and skips IDL registration for IDL-free templates.
crates/core/src/scenarios/protocols/bisonfi/overrides.yaml Defines the BisonFi account guard and price, depth, spread, and freshness byte layouts.
crates/core/src/tests/bisonfi/mod.rs Adds broad mainnet-backed validation of BisonFi layouts, guards, writes, and program behavior.
.github/workflows/openai-review.yml Adds a pull-request workflow that runs Codex and posts its final feedback as an issue comment.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    S[Scenario override] --> T[Resolve template and account]
    T --> G{Raw layout present?}
    G -->|Yes| V[Validate account size and magic/version]
    V --> E[Encode supplied values]
    E --> W[Write bytes at declared offsets]
    G -->|No| I[Resolve owner IDL]
    I --> D[Decode and update fields]
    D --> W
Loading

Reviews (9): Last reviewed commit: "Include the workflow" | Re-trigger Greptile

Context used (3)

…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.
@bakasura980 bakasura980 changed the title ⏺ feat: add BisonFi override templates feat: add BisonFi override templates Aug 20, 2026
…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.
@bakasura980
bakasura980 force-pushed the feat/kamino-protocol-support branch from 686cf07 to f71abb8 Compare August 24, 2026 12:20
Comment thread crates/core/src/scenarios/protocols/bisonfi/overrides.yaml Outdated
…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.
@bakasura980
bakasura980 force-pushed the feat/kamino-protocol-support branch from c40c4ea to 794b8e8 Compare August 25, 2026 11:23
@bakasura980
bakasura980 changed the base branch from feat/kamino-protocol-support to feat/scenarios/protocols/kamino August 26, 2026 09:45
@bakasura980
bakasura980 changed the base branch from feat/scenarios/protocols/kamino to feat/kamino-protocol-support August 26, 2026 09:45
@github-actions

Copy link
Copy Markdown
  • svm.rs:3015: Raw-layout overrides validate size/magic but not account ownership. A caller can target any matching 2,048-byte account, unlike the IDL path which selects by owner program. Include BisonFi’s program ID in RawLayout and reject accounts owned by another program before writing.

@bakasura980
bakasura980 changed the base branch from feat/kamino-protocol-support to feat/scenarios/protocols/kamino August 26, 2026 09:52
The Kamino PR was squash-merged into the base as 272e238, which has no
ancestry link to the feat/kamino-protocol-support history already in this
branch - so every merge re-derived the same six conflicts from two
unrelated lineages. 272e238's tree is byte-identical to the kamino tip
merged in d243443, so this records the parent and leaves the tree alone.
@github-actions

Copy link
Copy Markdown
  • .github/workflows/openai-review.yml:2: Using pull_request means OPENAI_API_KEY is unavailable for PRs from forks, so the Codex step will fail for external contributors. Add a fork-aware condition or document/use a secure alternative trigger.

Tests couldn’t run because Rustup attempted to write outside the permitted workspace. No other actionable issues found.

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.

2 participants