Skip to content

fix(lstar): skip the trivial single-signature aggregation round - #1191

Closed
koko1123 wants to merge 1 commit into
leanEthereum:mainfrom
koko1123:skip-trivial-single-signature-aggregation
Closed

fix(lstar): skip the trivial single-signature aggregation round#1191
koko1123 wants to merge 1 commit into
leanEthereum:mainfrom
koko1123:skip-trivial-single-signature-aggregation

Conversation

@koko1123

Copy link
Copy Markdown

Description / Motivation

Closes #747.

aggregate() currently runs a full recursive STARK proving round for the 1 raw signature + 0 children case. The prover cost is roughly constant in input size, and the resulting single-validator proof carries no information the raw gossip signature does not already carry. On the multi-client devnet this had lone-duty aggregators burning ~10.8 s of proving per slot to publish 1-validator aggregates (blockblaz/zeam#907).

What Changed

  • src/lean_spec/spec/forks/lstar/aggregation.py — the skip predicate becomes len(raw_signatures) + len(child_proofs) < 2: a round only runs with at least two pieces of evidence to combine. This is exactly equivalent to the two-condition form proposed in lstar/aggregate: skip trivial 1-raw-sig + 0-children case to avoid pointless STARK proving #747 ((C == 0 and R <= 1) or (R == 0 and C < 2)); both skip precisely {(R, C) : R + C <= 1}, verified by exhaustive enumeration. Only the 1 + 0 case changes behavior. The skipped signature stays in the raw pool (the bookkeeping below the loop already retains unconsumed signatures) and feeds a later round once more evidence for the same attestation data arrives.
  • tests/consensus/lstar/fork_choice/test_tick_acceptance_branches.py — new vector test_interval_2_aggregator_skips_single_raw_signature: a lone raw signature crosses the interval-2 aggregator action, the new aggregate pool stays empty, and the raw signature pool keeps the signature for a future round. Written first and confirmed failing against the previous predicate.
  • packages/testing/src/consensus_testing/test_types/block_spec.pybuild_signed_block_with_store() replayed block-carried votes through spec.aggregate(), so single-validator block attestations would silently vanish from built blocks, breaking 12 fork-choice scenario vectors whose fork weights are tuned around single votes. A proposer packaging a single vote remains valid on the wire (the harness already builds a 1-signature proof for the proposal component), so the harness now builds the skipped proofs directly and merges them into the known payload pool.

Note on acceptance criteria

The issue anticipated updating existing tests that land on 1 raw + 0 children to >= 2 raw signatures. It turned out none of the affected fillers exercise the aggregator branch as their subject: all 12 depended on the block-building harness routing votes through aggregate(). Fixing the harness preserves those scenarios' exact vote weights and tie-break semantics instead of rewriting them, which keeps their coverage intact.

Correctness / Behavior Guarantees

  • Wire format and verifier unchanged.
  • The raw signature stays on the gossip topic and in store.attestation_signatures; peers keep visibility of the vote.
  • Store invariant unchanged: consumed signatures are pruned, untouched signatures remain.

Testing

  • uv run fill --fork=Lstar --clean — 555 vectors pass, determinism gate passes.
  • just test — 2937 unit tests pass.
  • just check — lint, format, typecheck, spellcheck, mdformat, lock all pass.

🤖 Generated with Claude Code

A 1-raw-signature, 0-children aggregation round builds a recursive STARK
proof over a single validator. The prover cost is roughly constant in
input size, and the resulting proof carries no information the raw
gossip signature does not already carry, so the round is pure waste.

Extend the skip predicate in aggregate() so a round only runs with at
least two pieces of evidence to combine. The new single predicate,
len(raw_signatures) + len(child_proofs) < 2, is equivalent to skipping
the 0+0, 0+1, and 1+0 cases; only 1+0 changes behavior. The skipped
signature stays in the raw pool and feeds a later round once more
evidence for the same attestation data arrives.

The block-building harness previously relied on aggregate() to fold a
lone pooled signature into a payload for block inclusion. A proposer
packaging a single vote stays valid on the wire, so the harness now
builds those skipped proofs directly, mirroring its proposal component,
and scenario fillers keep their exact single-vote fork weights.

Closes leanEthereum#747
@koko1123

Copy link
Copy Markdown
Author

Closing in deference to #748, which implements the same change and predates this PR by two months — I missed it when picking #747 up from the issue tracker. @ch4r10t33r wrote the issue, measured the devnet impact (blockblaz/zeam#907), and implemented the fix first. I have offered my branch over on #748 as rebase material; the branch stays up if any of it is useful.

@koko1123 koko1123 closed this Jul 22, 2026
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.

lstar/aggregate: skip trivial 1-raw-sig + 0-children case to avoid pointless STARK proving

1 participant