Repository navigation
feat(pq): --pq-timing-output, the PQ devnets' shared timing export - #942
Open
pablodeymo wants to merge 1 commit into
Open
pablodeymo wants to merge 1 commit into
pablodeymo wants to merge 1 commit into
Conversation
pq-devnet-1 asks every client for its aggregation timings in a common format. Lighthouse, Prysm, Teku and Lodestar write one: schema 1 of Lighthouse's scripts/pq-measurement, a run directory holding run.json and zstd-compressed JSON-lines chunks, which its plot.py draws side by side. ethlambda wrote nothing. Step 2 of #938. `ethlambda beacon --pq-timing-output <DIR>` records, on a network that schedules PQ: - message_received and validated: every PQ attestation and aggregate that decodes, stamped at gossipsub delivery, and the verdict it got (p2p's beacon::pq::triage and verdict::report). - proof_started, proof_finished, candidate_ready, job_outcome: each committee proof of an aggregator seat (rpc's seat prover), and each merge of a block's attestation proofs, `initial` ahead of the slot and `improvement` at production (pq_attestation_packing). - proposal_snapshot: what block production built the block with. The export is ethlambda_telemetry::pq_timing: a process-wide session whose emitters return after one atomic load when no run is recorded. An event goes onto a bounded queue; a writer thread serializes, compresses and rotates chunks (64 MiB or five minutes, 8 GiB kept), and a full queue drops the event and counts it in run.json and in lean_beacon_pq_timing_dropped_events_total. The open chunk is flushed every ten seconds, so a killed node's .partial still decodes. run.json describes the run: client and leanVM revision, prover threads, hardware (from /proc and the cgroup tree), and where in a slot this node does each step. The node closes the run at shutdown. Adds zstd 0.13.5 and zstd-safe 7.4.1, resolved under the publish-age cooldown, over the zstd-sys RocksDB already builds. Cargo.lock gains those two packages and telemetry's edges, nothing else: a plain re-resolve would also have moved quinn and hyper-util to another socket2. Not ported: the other clients' --pq-measurement observer mode.
This branch has not been deployed
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
pq-devnet-1 asks every client to expose its aggregation timings "in a common format" (notes, Timings). Lighthouse, Prysm, Teku and Lodestar already write one: schema 1 of Lighthouse's
scripts/pq-measurement, a run directory ofrun.jsonplus zstd-compressed JSON-lines chunks that itsplot.pydraws side by side. ethlambda wrote nothing, so it is missing from those comparisons.This is step 2 of #938:
ethlambda beacon --pq-timing-output <DIR>.What Changed
The export (
crates/common/telemetry/src/pq_timing.rs,pq_timing/)A new module in
ethlambda-telemetry, next to the ClickHouse block telemetry and built the same way: a process-wide sink, off unless installed, whose emitters build nothing when it is off.recorder.rs: the run directory. Events go onto a bounded queue (16,384); apq-timing-writerthread serializes, compresses and writes. Chunks are finished after 64 MiB of events or five minutes, and a run keeps at most 8 GiB, removing the oldest first.run.jsonis rewritten whole whenever a chunk is finished and every 10 seconds. These are the other clients' numbers.pq_timing.rs: the typed events (message_received,validated,Job::{started, finished, ready, outcome},proposal_snapshot), the manifest, andtesting::capture(), which records into memory for tests of the emit sites (behind atest-utilsfeature).hardware.rs: thehardwareblock ofrun.json, from/procand the cgroup v2 tree, so a container reports the CPU quota and memory limit it was given.The emit sites
message_receivedp2p/src/beacon/pq.rs(triage)validatedp2p/src/beacon/verdict.rs(report)proof_started,proof_finishedrpc/src/beacon/pq_aggregation.rs(prove_committee)candidate_ready,job_outcomerpc/src/beacon/pq_aggregation.rs(prove_seat)proof_started,proof_finished,candidate_ready,job_outcomeblockchain/src/pq_attestation_packing.rsproposal_snapshotrpc/src/beacon/pq_proposal.rsGossipIdgainspq_vote, set bytriagewhen a receipt was recorded, soreportcan name the vote in itsvalidatedevent without decoding anything again.triagenow takes theGossipIdinstead of its arrival instant.How ethlambda's steps map onto the schema
work: a seat's committee proof iscommittee. The merge ahead of the slot isinitial(round 1) and the one at production isimprovement(round 2), which runs only when the first cannot be used. Teku maps its two merges the same way.reference_slot: the committee's own slot, and two slots before the block for a merge, as in the other clients.validated.outcome:accepted,rejected,ignored,duplicate(already seen, or covered by an accepted aggregate) andqueue_dropped(no validation permit free).job_outcome:already_provenandunprovedfor committees,skippedfor a merge with no time or no permit. A failed or late proof is already aproof_finishedevent, so it gets no second one.timing.initial_merge_nsis 20 s on a 12-second slot: a block's packing starts with its payload build, 8 s into the slot before it.The binary
--pq-timing-output <DIR>onbeacon(cli.rs).run_nodeinstalls the run after leanVM, since the manifest names the prover backend, andwait_for_shutdowncloses it. On a network that does not schedule PQ the flag logs a warning and records nothing.bin/ethlambda/src/pq_timing.rsbuilds what the run says about itself from the resolved network andConfig.Also
lean_beacon_pq_timing_dropped_events_total{class}, for a node whose export falls behind.payload_attributes::lookahead_startispub, so the manifest'sinitial_merge_nsis derived from the function the chain actor uses.docs/pq_timing.md(running, reading, the directory, every event and field), and pointers fromcli.md,metrics.md,beacon_pq.mdandCLAUDE.md.Dependencies
zstd0.13.5 andzstd-safe7.4.1, the safe wrappers over thezstd-sysRocksDB already builds. Both were resolved with the cooldown resolver: 0.13.6 and 7.4.2 were published three days ago and need azstd-systhat is just as new.Cargo.lockgains those two packages and the new edges of the workspace crates, 22 lines, and nothing else. A plain re-resolve also re-pointed packages this change has nothing to do with (quinn,quinn-udpandhyper-utilfromsocket20.5.10 to 0.6.3,iana-time-zoneto anotherwindows-core). I left those where they were;cargo metadata --lockedaccepts the result.Correctness / Behavior Guarantees
run.json'srecorder_status.droppedand in the new counter. The gossip path, the seat prover and the merge never wait on the disk.run.jsonwhen that is still possible, and later events are discarded..partialdecodes up to the last flush. A normal stop finishes and lists it.One behaviour change outside the export: the seat prover's loop now also logs
The PQ aggregate deadline passed with committees left to provewhen a proof that ran past the deadline leaves other committees unproved. It used to log that only when the deadline had passed before a proof started.Not ported: the other clients'
--pq-measurementobserver mode (step 3 of #938). A node with no aggregators or proposers records receipts and verdicts and no proof events. ethlambda's own attestations and aggregates are not in the export, since gossip never hands a node its messages back.Tests Added / Run
proof_started,proof_finished,candidate_readyand seat 1'salready_proven, in the test that already drives both seats.job_outcomeunder each round.The step-1 vote tests in p2p now run one at a time: they assert exact sample counts, which a second test triaging votes in parallel would break.
Run on the final tree:
make lintclean,make cooldown-checkclean,cargo metadata --lockedaccepted,make test4,222 passed, 0 failed, 97 ignored.Compatibility with Lighthouse's
plot.pyread_recordsandsummarizeon it. It built the production cohort, placed committee proofs and merge R1 at the offsets they were emitted at, counted the snapshots by outcome, and matched every receipt to its verdict.timing,hardware,prover_cpu_profile,prover_threads,recorder_status). Running it is the first item below.Not verified
plot.pyrenders an ethlambda run, next to a Lighthouse run from the same devnet.main.rsis compiled and its parts are tested, but no node has been run with the flag, against real leanVM or a devnet.Related Issues / PRs
✅ Verification Checklist
make fmt— cleanmake lint(clippy with-D warnings) — cleanmake test(test-consensusplustest-node, atrelease-fast) — all passing