fix(lstar): skip the trivial single-signature aggregation round - #1191
Closed
koko1123 wants to merge 1 commit into
Closed
fix(lstar): skip the trivial single-signature aggregation round#1191koko1123 wants to merge 1 commit into
koko1123 wants to merge 1 commit into
Conversation
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
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description / Motivation
Closes #747.
aggregate()currently runs a full recursive STARK proving round for the1 raw signature + 0 childrencase. 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 becomeslen(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 the1 + 0case 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 vectortest_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.py—build_signed_block_with_store()replayed block-carried votes throughspec.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 childrento>= 2raw 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 throughaggregate(). 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
store.attestation_signatures; peers keep visibility of the vote.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