Repository navigation
Description
Context
#914 (pq-devnet-0) moved a PQ block's attestation packing, and the leanVM merge of the packed aggregates' proofs, off the proposal's critical path. The chain actor starts it a third of a slot before the proposal, when it starts the payload build, and pq_blocks takes the result if its slot, head and pool candidates still match. Otherwise it packs at the slot as before. That merge was the largest part of block production there, ~575 ms. After #914 (deployed together with the #899 port), our median block arrival on pq-devnet-0 dropped from ~1.24 s to ~0.70 s (13 blocks).
Should main's produceBlockV3/V4 do the same for BLS? #900 already starts the payload build a third of a slot ahead for both fulu and gloas, so attestation packing is the main consensus-side work still done when the validator client asks for the block.
What main does at request time
pack in crates/net/rpc/src/beacon/proposal.rs (and the gloas path in gloas_proposal.rs):
-
AttestationPool::block_candidates()(crates/storage/src/pools/attestation.rs) BLS-aggregates the pooled single votes of every (data, committee) it holds, up to an epoch of them. It then keeps either that aggregate or the recorded gossip aggregate, whichever has more bits set. -
pack_attestations(state_transition/src/beacon/block_production.rs) does four things:- counts new attesters for every includable candidate (
get_attesting_indicesagainst participation); - merges candidates with the same data across committees (EIP-7549), which aggregates their signatures;
- ranks the merged attestations;
- verifies each merged attestation's aggregate signature against the state (
is_valid_indexed_attestation), up toMAX_ATTESTATIONS_ELECTRA(8), plus one per attestation it drops.
On mainnet, the previous slot's head vote merges across all 64 committees into one attestation with roughly 30,000 attesters. Each check therefore aggregates tens of thousands of public keys (cached decompressed in
PubkeyCache) before its pairing. - counts new attesters for every includable candidate (
-
Gloas adds
pack_payload_attestations(aggregate and verify the PTC votes). Both forks also runverified_sync_aggregateandpack_operations.
None of this is timed: Produced block logs no duration and no metric wraps pack.
What decides it
-
What it costs. If packing a mainnet-sized block takes tens of milliseconds, there is nothing to win. At a few hundred, the perf(pq): merge a block's attestation proofs ahead of its slot #914 shape applies.
- Our devnets cannot answer this: with a few hundred validators, a committee has a handful of members.
- It needs committees of mainnet size. One way is a mainnet or Hoodi follower timing
packeach slot against its head state advanced to the next slot, as if it were proposing. Another is a bench over a dumped pool and state. - Either way, a histogram around
packis worth keeping, so proposals report it.
-
The inclusion delay is one slot on
main, not two. A block at S packs S − 1's attestations, the ones that count most (head votes, most new attesters).- Fulu: S − 1's aggregates are due at
AGGREGATE_DUE_BPS(66.67% of S − 1), the moment the payload build starts. A packing started then would miss nearly all of them, so it would need a top-up at S: pre-verify and rank what is older ahead, and aggregate and verify only S − 1's at the slot. - Gloas: aggregates are due at
AGGREGATE_DUE_BPS_GLOAS(50%), 2 s before the build starts. A packing started with the build would hold most of S − 1's aggregates, and only late arrivals would need the check-and-repack-at-S that perf(pq): merge a block's attestation proofs ahead of its slot #914 does.
PQ has a whole slot of margin (
MIN_ATTESTATION_INCLUSION_DELAY_PQ= 2), which is why perf(pq): merge a block's attestation proofs ahead of its slot #914 can take its packing as is. - Fulu: S − 1's aggregates are due at
Shape, if it's worth it
The pattern is the one #914 used: a packing started next to the payload build (start_payload_build in crates/blockchain/src/payload_attributes.rs, which feeds PreparedPayloads), shared with block production. Production takes it only for its own slot and head, and only when the pool's candidates have not changed. Otherwise it packs at the slot as today. The PQ version is crates/blockchain/src/pq_attestation_packing.rs on pq-devnet-0. Fulu would need the incremental top-up above rather than a plain match.
References
- perf(pq): merge a block's attestation proofs ahead of its slot #914: the PQ version, with this question in its description.
- perf(beacon): start the payload build a third of a slot ahead (#894) #900: the payload build a third of a slot ahead, on
main.
Activity