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

Adds declarative Tessera market-state preparation and exposes fair-value scenario creation through MCP.

  • Registers six raw-layout Tessera override templates and a 26-market catalog.
  • Builds reciprocal fair-value fields from market and mint account data.
  • Adds an MCP tool that reads from a caller-selected Surfnet and stages the generated scenario.
  • Adds deployment-pinned live tests and Tessera integration documentation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported RPC-target issue is fixed because both Tessera account-fetch stages use the caller-selected Surfnet port.

Important Files Changed

Filename Overview
crates/mcp/src/surfpool/mod.rs Adds the Tessera scenario tool and consistently forwards the optional selected Surfnet port to both market and mint account reads.
crates/core/src/scenarios/protocols/tessera/v1/fair_value.rs Validates Tessera market and mint accounts, converts human prices into reciprocal atomic ratios, and builds paired price and freshness overrides.
crates/core/src/scenarios/protocols/tessera/v1/overrides.yaml Defines the guarded raw account layout, six Tessera templates, and the market metadata catalog.
crates/core/src/scenarios/registry.rs Compiles and registers the six Tessera templates in the default registry.

Sequence Diagram

sequenceDiagram
    participant Client as MCP client
    participant Tool as Tessera MCP tool
    participant Surfnet as Selected Surfnet RPC
    participant Builder as Fair-value builder
    participant Studio as Scenario API
    Client->>Tool: market, price, surfnet_port
    Tool->>Surfnet: Read market account
    Surfnet-->>Tool: Market bytes
    Tool->>Surfnet: Read base and quote mints
    Surfnet-->>Tool: Mint decimals
    Tool->>Builder: Validated market and human price
    Builder-->>Tool: Price and freshness overrides
    Tool->>Studio: Stage scenario
    Studio-->>Client: Editor URL
Loading

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

Context used (3)

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

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

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