Skip to content

Verified equivalence of incremental (proto-array-style) LMD-GHOST head vs naive spec walk #67

Description

@adust09

Context

Upstream's _compute_lmd_ghost_head re-tallies votes on every call — a naive walk. Production clients use proto-array / incremental weight-delta structures instead. Today, every client team re-derives the correctness of that optimization informally.

Our proof assets already cover the naive side: FC-1 (update_head_deterministic, computeLmdGhostHead_in_store), FC-2 (head_descends_from_justified), FC-4 (fork_choice_acyclic via properAncestor_slot_lt).

Proposal

  1. Model an incremental weight-cache head computation (proto-array style: per-block weight deltas, best-child/best-descendant propagation) in LeanSpec/Forks/Lstar/Store/.
  2. Prove the refinement theorem: for any Store.WellFormed store, incremental head = computeLmdGhostHead head (including tie-break behavior, which is content-derived since fix(fork-choice): make the equal-slot equivocation tie deterministic leanEthereum/leanSpec#1181 — insertion-order independence is what makes this statement well-posed).
  3. Publish the theorem as a conformance target: clients implementing proto-array can point at a machine-checked proof that their algorithm agrees with the reference spec.

Why

Highest-value item in the verified-refinement direction: the spec stays naive and readable, while the one optimization every client actually ships gets a mechanized correctness proof shared across teams. Divergent tie-break or delta-propagation bugs in this layer are exactly the cross-client interop failures the reference spec exists to prevent.

Estimated scope

Medium — requires new modeling (weight deltas, propagation invariants), not just re-plumbing existing lemmas. Good milestone after the fuel-removal work (see companion issue), since the walk lemmas get cleaner first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions