Skip to content

feat(scenarios): add Tessera state preparation - #11

Open
92Infinitus92 wants to merge 1 commit into
feat/bisonfi-supportfrom
feat/tessera-support
Open

feat(scenarios): add Tessera state preparation#11
92Infinitus92 wants to merge 1 commit into
feat/bisonfi-supportfrom
feat/tessera-support

Conversation

@92Infinitus92

@92Infinitus92 92Infinitus92 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #8 — Tessera is the same mechanism class as BisonFi (PMM, no IDL) and reuses the raw-layout engine it introduced.

  • Everything declarative: 6 templates over the market account (fair value, depth, curve, halt, freshness, stale quote) plus a 26-market catalog carrying each market's mints, decimals and freshness limit.
  • One builder (fair value): turns a human price into the two reciprocal atomic-ratio fields using the market's mint decimals, and pairs a persistent freshness override so the prepared quote stays live on the fork.
  • One MCP tool, create_tessera_fair_value_scenario, on the generic scenario path. No protocol HTTP endpoints.
  • 8 live gated tests against the deployed program (staleness boundary 0xffff, halt, ladder scaling), on shared live-test helpers.
  • The three MCP helpers duplicate the pump branch's on purpose — they fold together when the branches converge.
  • monitoring.yaml is documentation only: the program-upgrade fingerprint and the catalog refresh procedure.

Greptile Summary

The PR adds Tessera state preparation through raw-layout scenario templates and an MCP fair-value builder.

  • Registers six Tessera override templates and a 26-market catalog.
  • Converts human prices into reciprocal atomic ratios using live mint decimals.
  • Adds an MCP tool that reads accounts from the selected Surfnet and stages the generated scenario.
  • Adds gated live tests for layout, quote, freshness, halt, and ladder behavior.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
crates/mcp/src/surfpool/mod.rs Adds the Tessera MCP workflow and consistently uses the optional target Surfnet port for both account-read phases.
crates/core/src/scenarios/protocols/tessera/v1/fair_value.rs Validates Tessera market and mint data, derives reciprocal atomic ratios, and builds coordinated price and freshness overrides.
crates/core/src/scenarios/protocols/tessera/v1/overrides.yaml Defines Tessera raw-layout guards, market metadata, and the six declarative override templates.
crates/core/src/scenarios/registry.rs Registers the new Tessera templates with the scenario registry.
crates/core/src/tests/tessera/mod.rs Adds gated integration coverage against the pinned Tessera deployment.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Client[MCP client] --> Tool[create_tessera_fair_value_scenario]
    Tool -->|surfnetPort| RPC[Target Surfnet RPC]
    RPC --> Market[Read market account]
    Market --> Mints[Read referenced mint accounts]
    Mints --> Builder[Validate layout and derive reciprocal ratios]
    Builder --> Scenario[Build price and persistent freshness overrides]
    Scenario --> Studio[Stage through scenarios API]
Loading

Reviews (4): Last reviewed commit: "feat(scenarios): add Tessera state prepa..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
  • P1 – MCP tool ignores the selected surfnet port (mod.rs): fetch_surfnet_accounts always connects to DEFAULT_RPC_PORT. start_surfnet may choose 18899, 28899, etc., and stores that port in self.surfnets; in those cases the Tessera tool fails or reads an unrelated process. Accept a surfnet/RPC parameter or resolve the active port from self.surfnets.

Comment thread crates/mcp/src/surfpool/mod.rs Outdated
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

No actionable findings in the reviewed diff.

The previously reported RPC-target issue is fixed at 8539d42: surfnet_port is caller-selectable and used for both market and mint account reads.

Tests could not run because Rustup attempted to write outside the permitted workspace.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
  • [P2] fair_value.rs:183-190 silently truncates prices with more precision than the atomic ratio supports. The scenario label still reports the requested price although a lower price is applied. Reject non-zero discarded digits or explicitly report the normalized price.

Tessera is a proprietary market maker with no IDL, so its market accounts are
written through the raw byte layout the BisonFi work introduced. Eight templates
cover price, depth, curve, halt, staleness and freshness.

The market catalog lists all 26 live markets with their mints, decimals and
freshness limit, so the UI constrains the choice and a model can resolve one
through search_constant_options.

One builder exists, for the only thing a template cannot express: turning a human
price into the pair of reciprocal atomic ratios, which needs both mints' decimals.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

No actionable issues found in the PR changes.

Focused tests could not run because Rustup attempted to write under the read-only /home/runner/.rustup directory. Static review covered the builder, MCP flow, templates, registry, and test gating.

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