Skip to content

fix(tessera): Rework Tessera to use keep_alive - #46

Merged
bakasura980 merged 2 commits into
feat/tessera-supportfrom
feat/tessera-keep-alive
Nov 5, 2026
Merged

bakasura980 merged 2 commits into
feat/tessera-supportfrom
feat/tessera-keep-alive

Conversation

@bakasura980

Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

This PR drops the tessera-freshness template and replaces it with a file-level keep_alive import. The import points at a new tessera-quote-publication keep-alive template. Each slot it writes the current slot to offset 120 and clears the used buy and sell depth at offsets 0 and 8, which is what the maker's republication does on mainnet. The registry counts, the README and the llm_context text are updated to match. The tests now drive the shipped keep-alive import, and a new test checks that a republication gives back the depth that swaps used up.

Overall this is a clear improvement in usability: callers no longer have to schedule a freshness override every 4 slots. The new tests are well targeted: the write-set check, the freshness-limit boundary, and the restored depth.

Concerns

  • Lost capability: a stale maker can no longer be simulated on an overridden market. The "Stale maker" scenario and the "Make the quote stale" recipe are removed. Keep-alive overwrites last_update_slot every slot, so even a custom raw override at offset 120 is undone in the next slot. The only stale path left is a market that no override touches, and that market cannot also be repriced or thinned. This is a real loss for testing router fallback, e.g. "Tessera at price X goes stale". Please call it out explicitly in the PR or README, or consider a template that stops keep-alive for one market.
  • The buy-side reset at offset 0 is never exercised. tessera_keep_alive_restores_the_depth_swaps_use_up checks only the sell side (offset 8). A buy-direction check would confirm that offset 0 really is the used buy depth in quote atoms.
  • Duplicate troubleshooting entry. The README has two Custom(65535) rows ("did not override" and "did not halt") with different explanations. Merging them into one row that lists both causes would read better.
  • Wording. "younger than its grace period, which keep-alive keeps it" is ungrammatical. It appears in both the README and overrides.yaml.

keep_alive:
- template: tessera-quote-publication
address: { type: override }
values: { last_update_slot: $slot, buy_depth_used: 0, sell_depth_used: 0 }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Every Tessera template, tessera-halt included, now enrols its market in keep-alive for the rest of the network's life. That makes a stale quote impossible to produce on any market a scenario touches. Before this PR, tessera-freshness with a negative offset covered that case, and the "Stale maker" scenario relied on it. Is this regression intended? If so, please document it. Otherwise consider an opt-out, such as a template that stops keep-alive for one market.


The formulas hold for a quote younger than its grace period (see
[How a quote ages](#how-a-quote-ages)) and with neutral quote-start configs. The five quote-start configs at offset 1136 can lower a fill or make it skip leading levels. Which
The formulas hold for a quote younger than its grace period, which keep-alive keeps it (see

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Grammar: "younger than its grace period, which keep-alive keeps it". Suggest: "…a quote younger than its grace period, as keep-alive keeps it (see …)". The same phrasing appears in overrides.yaml in the tessera-price llm_context.

| Symptom | Fix |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------- |
| `Custom(65535)` after a price, depth or curve change | The quote is stale. Add `tessera-freshness` with `last_update_slot: 0` in that slot |
| `Custom(65535)` on a market you did not override | Expected: nothing republishes a market no override names, so it went stale |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This row and the next one both start with Custom(65535) on a market…, but each gives a different cause. A reader matching on the symptom has to read both. Consider one row: "Custom(65535): the market was never overridden, so it aged past its limit, or the maker pulled that side upstream."

@bakasura980
bakasura980 merged commit 9b21352 into feat/tessera-support Nov 5, 2026
3 checks passed
@bakasura980
bakasura980 deleted the feat/tessera-keep-alive branch November 5, 2026 08:22
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