Repository navigation
feat(pq): expose aggregation timings as Prometheus metrics - #973
Conversation
Ports #941 (step 1 of #938) onto pq-devnet-2, exposing the 11 PQ aggregation, merge, verification, and arrival series on `/metrics`, all lazily registered so a network without PQ shows none: - Committee proofs, by aggregator seat (`rpc`'s seat prover): leanVM's proving time, how far into the slot the proof was ready, its signatures and size, and `lean_beacon_pq_committee_proofs_total` by outcome (`proved`, `late`, `failed`, `already_proven`, `unproved`). - Block-proof merges, by phase (`ahead` of the slot, at `production`): duration, children and merged size when the merge ends, in time or not, and `lean_beacon_pq_merges_total` by outcome (`merged`, `failed`, `late`, `skipped`). - `lean_beacon_pq_proof_verification_seconds`, by kind: an `aggregate`'s proof in the gossip rules, a `block`'s merged proof in `process_stark`. - `lean_beacon_pq_gossip_arrival_offset_seconds`, by topic kind: every attestation and aggregate that decodes, from the start of its own slot. Preserves pq-devnet-2's OTLP PQ telemetry hooks (`ethlambda_telemetry::pq_events`) across `pq_aggregation`, `pq_attestation_packing`, and `gossip::pq`, sharing the proof-verification timer between Prometheus and OTLP.
|
/review |
AI security review: 1 finding(s) to checkReviewed by Opus, GPT, Kimi, DeepSeek. A judge model checked every one of the findings against the code.
DetailsM1. PQ committee-proof counter skips committees when a seat wakes after its deadline (low, logic)
Duplicates folded into another finding: 1
Cost of this review: ~$1.67 of a $30 budget (estimated from token counts). |
…kes past deadline Addresses security review finding M1 on PR #973: When an earlier aggregator seat's blocking proof overran past a later seat's broadcast deadline (`budget == 0`), `prove_seat` returned early before updating `lean_beacon_pq_committee_proofs_total`. Unify the zero-budget case into `prove_seat`'s `spawn_blocking` pass (`budget = deadline_ms.saturating_sub(now_ms())`) so: - `head(&store)` always runs on the blocking pool rather than the async runtime thread, and seats this node does not hold return quietly. - Committees an earlier seat already proved in full are still counted as `already_proven` (`suppressed`/`already_covered`), zero-input committees close as `no_inputs`, and committees with unproved collected signatures stop at the deadline check without invoking leanVM and are counted as `unproved` on `/metrics` (with `available_signers` attached to every abandoned telemetry duty).
|
/review |
AI security review: 2 finding(s) to checkReviewed by Opus, GPT, Kimi, DeepSeek. A judge model checked every one of the findings against the code.
DetailsM1. Peers can inject arbitrary samples into lean_beacon_pq_gossip_arrival_offset_seconds before any validation (low, logic)
M2. PQ committee-proof total counts collected proof groups rather than every seated committee (low, logic)
Cost of this review: ~$1.63 of a $30 budget (estimated from token counts). |
…mittees Addresses the two findings of the second security review on PR #973. M1: `lean_beacon_pq_gossip_arrival_offset_seconds` was observed right after SSZ decode, from the slot the message itself names. A peer could send votes naming any slot with junk signatures, have them ignored at no cost to its score, and write the samples it liked (a slot long past reads as the time since genesis). The offset is now observed in `PqValidated::forward` on `Accept` only, still measured from when the message came off the wire: an accepted vote is in the current or the previous epoch, signed by its validator and the first for its key. M2: `lean_beacon_pq_committee_proofs_total` derived every outcome from the collected signature groups, so a seated committee that collected no signature left no trace. It is now counted once as `no_inputs`. The counter's unit is stated as what it counts, the aggregate (one committee's signatures on one vote, which is what one proof covers): a committee whose attesters split over two votes is due one per vote, and `proved` plus `late` stays equal to the sample count of `lean_beacon_pq_committee_proof_seconds`. The seat's summary log reports `committees` as the seated committees, with `aggregates` and `no_inputs` beside it.
|
/review |
AI security review: 1 finding(s) to checkReviewed by Opus, GPT, Kimi, DeepSeek. A judge model checked every one of the findings against the code.
DetailsM1. New rpc test can fail at random: it makes absolute assertions on an unlabelled global histogram that a parallel test also writes to (low, other)
Cost of this review: ~$2.71 of a $30 budget (estimated from token counts). |
Addresses the third security review's finding M1 on PR #973. `lean_beacon_pq_committee_proof_size_bytes` and `lean_beacon_pq_committee_proof_signatures` carry no `position` label, and the metrics are the process's, so every test that makes a proof through `prove_seat` writes the same two series. `a_seats_proving_pass_is_timed_and_counted` asserted the size histogram's absolute count and a signature sum delta, and `a_split_committee_counts_per_vote_and_a_quiet_one_as_no_inputs`, added with the previous fix, makes two proofs on another libtest thread: whether the first passed depended on which ran when. Every test that drives `prove_seat` now holds one lock, and the unlabelled series are read as what the pass adds instead of as absolute values. Test code only.
|
/review |
AI security review: 0 finding(s) to checkReviewed by Opus, GPT, Kimi, DeepSeek. No findings to check. Cost of this review: ~$2.18 of a $30 budget (estimated from token counts). |
Summary
Ports #941 (step 1 of #938) onto
pq-devnet-2, exposing the eleven PQ aggregation, merge, verification, and vote-arrival Prometheus series on/metricsalongsidepq-devnet-2's OTLP PQ telemetry hooks:lean_beacon_pq_committee_proof_secondspositionlean_beacon_pq_committee_proof_ready_offset_secondspositionlean_beacon_pq_committee_proof_signatureslean_beacon_pq_committee_proof_size_byteslean_beacon_pq_committee_proofs_totalposition,outcomeproved,late,failed,already_proven,unprovedlean_beacon_pq_merge_secondsphaselean_beacon_pq_merge_childrenlean_beacon_pq_merged_proof_size_byteslean_beacon_pq_merges_totalphase,outcomemerged,failed,late,skippedlean_beacon_pq_proof_verification_secondskindaggregate's proof or oneblock's merged prooflean_beacon_pq_gossip_arrival_offset_secondskindConflict resolutions on
pq-devnet-2crates/net/rpc/src/beacon/pq_aggregation.rs:prove_committeereturns(Arc<PooledPqAggregate>, Duration, Option<proof::Plan>), feeding bothmetrics::observe_pq_committee_proof/inc_pq_committee_proofsandpq_eventsduty/operation hooks.crates/blockchain/src/pq_attestation_packing.rs:pack_attestationsrecords bothmetrics::observe_pq_merge/inc_pq_mergesand thepq_events::proof::Plan/duty::remember_resultlifecycle.crates/blockchain/state_transition/src/beacon/gossip/pq.rs: Uses a singleInstant::now()timer aroundverify_aggregatesfor bothobserve_pq_proof_verification("aggregate", elapsed)andpq_events::gossip::record_current_proof_verify_ns.docs/metrics.md: Appends### PQ Aggregation Timingcleanly alongside### PQ Measurement Exporter Healthwithout overlapping feat(telemetry): emit PQ events at wire 0.5 (pq-measurement-spec, registry 0.10.0) #972.Related Issues / PRs
pq-devnet-2Verification
cargo fmt --checkcargo clippy --workspace --all-targets -- -D warningsethlambda-metrics,ethlambda-state-transition,ethlambda-p2p,ethlambda-rpc, andethlambda-blockchain