Skip to content

Derived caches each build their own read-state key, and two leave out the index root #2443

Open

Description

@bplatz

Caches derived from ledger state each build their own key from a hand-picked set of view fields:

They disagree on what identifies a state. The result cache and the stats cache include the index root; the GraphQL and reasoning caches key on the index t instead. The stats cache uses the overlay's epoch, the others its content version.

The difference is observable. A ledger dropped, created again, indexed and reloaded agrees with the dropped one on t, index t and overlay content version; only the index root differs. #2403 pins that case for the result cache (a_reloaded_ledger_is_told_apart_by_its_index_root). A cache keyed without the root would serve the dropped ledger's entry. Not yet reproduced for the GraphQL and reasoning caches.

Proposal: one read-state token in core, built from GraphDbRef by destructuring every field it reads, that every derived cache keys on, so a new field or a new kind of state (on next: instance_bits, fence, erasure_generation, the head commit_id) widens all of them at once. #2403's GraphDb::hash_for_result_cache is the per-cache form of this.

Activity

  1. added
    bug
    P2
    area:query
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:querybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions