Skip to content

Prove attestation processing is order-independent and idempotent (aggregation-first pipelines) #72

Description

@adust09

Context

Proven assets over the attestation fold (LeanSpec/Forks/Lstar/CheckpointForward.lean, LeanSpec/Forks/Lstar/StateTransition.lean):

  • foldlM_processAttestation_mono / _forward / _jf / _justified — the fold only moves justification state forward.
  • VAL no_double_vote / no_double_vote_after — a repeated vote from the same validator has no effect.

What is not yet stated is the algebraic structure these strongly suggest: each processAttestation is a monotone, idempotent update on a join-semilattice of justification bits, so the fold result is invariant under permutation and deduplication of the batch.

Proposal

  1. Prove commutativity: processAttestation a ∘ processAttestation b and the swapped composition reach the same state (both land on "bits {a,b} set", and checkpoint promotion depends only on the reached bit-set).
  2. Prove idempotence as a fold-level statement: foldl processAttestation s l = foldl processAttestation s (dedup l) (lifting no_double_vote).
  3. Combine into the batch theorem: the fold result is invariant under any permutation + dedup of the attestation list.
  4. Feed upstream as spec text: implementations may reorder, deduplicate, and aggregate attestations before applying them — currently only implied, never guaranteed.

Why

Aggregation-first processing is what real clients do with gossip batches; today its correctness against the sequential spec fold is folklore. A permutation-invariance theorem makes the reference fold order-free by construction and rules out a class of cross-client divergence (same attestation set, different arrival order).

Estimated scope

Small–medium — the monotonicity/idempotence lemmas exist; the new work is the pairwise commutation lemma and the standard fold-permutation lifting.

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