Skip to content

feat(pq): pq-devnet-2 — ERC-8517 PQ keys, X_COMMITTEE_COUNTS rotation, eth.telemetry/0.4 events - #961

Open
pablodeymo wants to merge 3 commits into
pq-devnet-1from
pq-devnet-2
Open

pablodeymo wants to merge 3 commits into
pq-devnet-1from
pq-devnet-2

Conversation

@pablodeymo

@pablodeymo pablodeymo commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

🗒️ Description / Motivation

What ethlambda needs for pq-devnet-2 (spec, target launch 08.12.2026). It relaunches pq-devnet-1 at 65,536 validators with three changes every client has to carry:

  1. ERC-8517 key derivation. PQ keys come from the mnemonic, not from the BLS signing key. Every leanXMSS public key and VRF root changes, so a client still deriving from BLS computes a key that is not in the state.
  2. Rotating committee geometry (X_COMMITTEE_COUNTS, consensus-specs#5879). The devnet runs [16, 8, 4, 2, 1], eight epochs a stage.
  3. PQ measurement telemetry. Every client must emit the pq.* events of the PQ measurement spec over OTLP Logs, behind --telemetry-events=pq. It is a launch requirement this time. This PR emits wire eth.telemetry/0.4, the spec's current version.

Stacked on pq-devnet-1 (#896), the same way that one is stacked on pq-devnet-0.

What Changed

1. ERC-8517 PQ keys

  • Derivation (ethlambda_crypto::pq_keys):

    • The account seed is derived at the all-hardened path m/5326/3600/<chain_id>/<role>/<account>: HMAC-SHA512("Ethereum PQ seed", seed), then hardened child steps.
    • The leanXMSS seed is HKDF-Expand-SHA256(account_seed, "leanXMSS key"), and the VRF seed uses "VRF key".
    • Role 0 is a validator and role 1 a builder. A builder derives no VRF seed.
    • A seed outside 16..=64 bytes, a chain_id outside [1, 2^31), an unsupported role, or an account at or above 2^31 is refused, never reduced into range.
  • Validator client (crates/validator, bin/ethlambda/src/validator.rs). It loads account seeds from three sources:

    • ERC-8519 v5 "leanxmss" keystores, found in --validators-dir or imported through POST /eth/v1/keystores.
    • --pq-mnemonic with --pq-account-min/--pq-account-max, and optionally --pq-passphrase, --pq-chain-id and --pq-role.
    • --pq-seeds-file, which reads eth2-val-tools pq-seeds output or one hex seed per line.

    Any entry whose chain_id disagrees with the beacon node's DEPOSIT_CHAIN_ID is refused. --secrets-dir now defaults to <validators-dir>/secrets. The stored leanXMSS trees are named by XMSS public key instead of BLS public key.

  • ethlambda pq-keys: takes --chain-id and --role, and --write-xmss-cache also writes the .xmss tree caches. The default file stem now includes the chain id, since the path does.

  • Known answers: the spec's check values for accounts 0 and 1 (chain id 3151908: account seed, leanXMSS seed, VRF seed and public key) are pinned as tests in pq_keys.rs.

2. X_COMMITTEE_COUNTS

  • Config (crates/common/types/src/beacon/config.rs): CommitteeCounts is a list of distinct positive powers of two, kept in file order. The count at an epoch is X_COMMITTEE_COUNTS[(epoch // 8) % len]. An empty or missing list falls back to X_MAX_COMMITTEE_COUNT_PER_SLOT.
  • Storage: the list is stored in a Metadata row of its own (config_x_committee_counts), like GAS_LIMIT_SCHEDULE, so DB_VERSION stays 10. A resume refuses a changed list.
  • State transition and helpers: the committee count is read per epoch (committee_count_per_slot_at_epoch), and the PQ epoch processing and gossip rules use it.
  • Startup check: on a PQ-at-genesis network the node checks that the genesis validators can fill every stage, and that genesis.ssz's aggregation_committee_window matches the first epochs' counts.
  • Peer scoring: gossipsub's expected aggregators per slot follow the active stage.
  • Beacon API: /eth/v1/config/spec serves the list as decimal strings when it is not empty.

3. --telemetry-events=pq

  • New module ethlambda_telemetry::pq_events: the event records, an OTLP Logs exporter over grpc and http/protobuf configured through the standard OTEL_* variables (OTEL_RESOURCE_ATTRIBUTES must carry eth.node.id), and the pq_measurement_* exporter-health counters on /metrics.
  • Both beacon and validator take the flag. The beacon node starts the exporter only on a network that schedules PQ, and flushes it at shutdown.
  • Call sites: gossip receipt, validation and publication of aggregates (p2p/src/beacon/pq.rs, gossipsub/handler.rs, swarm_adapter.rs), proving (crypto/src/stark.rs, stark/leanvm.rs), the node's aggregation duties (rpc/src/beacon/pq_aggregation.rs) and proposal-time proof merging (pq_attestation_packing.rs).
  • pq.validation_batch is never emitted. The node validates aggregates one by one, and pq.context declares validation_batching: individual.
  • Wire 0.4 (fcbf6a87). The devnet note says 0.3, but the spec moved to 0.4 on Dec 2 and xatu's sentry accepts both (feat(otlp): support measurement wire 0.4 duty timing ethpandaops/xatu#1021), so this emits 0.4:
    • pq.duty_scheduled names its nominal target as scheduled_publish_unix_ns for both duty kinds.
    • pq.duty_completed has no late flag.
    • A duty abandoned at its cutoff (missed_deadline) carries that cutoff as deadline_unix_ns. The beacon node's cutoff for a committee seat is the seat's broadcast time. The validator client's cutoff for a proposal is the slot's attestation time.
  • This replaces feat(pq): --pq-timing-output, the PQ devnets' shared timing export #942. That PR is the schema 1 file export (--pq-timing-output) pq-devnet-1 asked for. It is not in this branch, and pq-devnet-2 asks for the OTLP events instead.

Docs

docs/beacon_pq.md, docs/cli.md (new flags and a pq-keys section), docs/metrics.md (the exporter-health counters) and CLAUDE.md.

Open points

  • Spec pin. The devnet pins ethereum/consensus-specs@66f143ec. The module headers and docs/beacon_pq.md still name pq-devnet-1's 4c296784, and this PR adds only #5879 on top of it. Any other consensus change between the two commits has not been audited here.
  • leanVM. The devnet's leanVM pin is still TBD. This branch stays on bindings v0.19.0 (351f7ae4).
  • Keystore format. The spec lists the keystore encoding as an open item. The ERC-8519 v5 "leanxmss" shape here may need to change once clients agree on one.

Testing

  • make fmt and make lint pass on the first commit. On the second, cargo fmt --check passes and clippy passes with -D warnings on the crates it touches.
  • cargo test --profile release-fast -p ethlambda-telemetry -p ethlambda-crypto -p ethlambda-types -p ethlambda-validator -p ethlambda-rpc passes (the crates' #[ignore]d tests were not run).
  • Telemetry against the spec's own tools (pq-measurement-spec 3b9eb6b, wire 0.4):
    • The 17 records the lifecycle test exports validate against schema.json and tools/metadata.py.
    • The raw OTLP protobuf requests the exporter sent decode through the spec's reference mapper (tools/otlp.py) into the same records.
    • A one-off sweep of 89 more records also validates. It covered rejected, ignored, dropped and deferred aggregates, failed publications, failed and discarded proofs, superseded and suppressed duties, and the validator client's context.
  • Not done: a live run against a collector or xatu, and the cross-client gossip-ID check the spec asks for before claiming conformance.
  • The full make test and the beacon spec suites (make test-beacon) have not been run.

… eth.telemetry/0.3 events

pq-devnet-2 (notes.ethereum.org/@ethpandaops/pq-devnet-2) relaunches
pq-devnet-1 with three changes every client has to carry.

ERC-8517 key derivation. PQ keys no longer derive from the BLS signing
key. Each account's seed comes from a BIP-39 seed at the all-hardened path
m/5326/3600/<chain_id>/<role>/<account> (HMAC-SHA512 under "Ethereum PQ
seed", then HKDF-Expand-SHA256 with "leanXMSS key" and, for validators,
"VRF key"). Out-of-range seeds, chain ids, roles and accounts are refused,
never reduced into range. The validator client loads seeds from ERC-8519
v5 "leanxmss" keystores, from --pq-mnemonic with an account range, or from
--pq-seeds-file, and refuses any whose chain id disagrees with the beacon
node's DEPOSIT_CHAIN_ID. `ethlambda pq-keys` takes --chain-id and --role
and can write the leanXMSS tree caches. The devnet's check values for
accounts 0 and 1 are pinned as tests.

X_COMMITTEE_COUNTS (consensus-specs #5879). The PQ committee count per
slot rotates through the configured list, eight epochs a stage. The list
is a Config field stored in a Metadata row of its own, so DB_VERSION
stays 10; a resume refuses a changed list. A PQ-at-genesis network is
checked at startup for enough validators to fill every stage, and
gossipsub's expected aggregators follow the active stage.

PQ measurement telemetry. --telemetry-events=pq on `beacon` and
`validator` exports the pq.* events of eth.telemetry/0.3 over OTLP Logs
(grpc or http/protobuf, configured through OTEL_* variables), with
pq_measurement_* exporter-health counters on /metrics.
…istry 0.9.0)

The measurement spec moved its wire from eth.telemetry/0.3 to 0.4 on
Dec 2 and xatu's sentry takes both (ethpandaops/xatu#1021). 0.4 separates
a duty's nominal publication target from the cutoff at which a client
gives the duty up:

- pq.duty_scheduled names its target as scheduled_publish_unix_ns, for
  both kinds (was broadcast_unix_ns and proposal_unix_ns).
- pq.duty_completed has no `late` flag. Whether a publication was late is
  the analysis's subtraction, not the client's.
- outcome=missed_deadline carries deadline_unix_ns, the cutoff the
  abandoning path ran against, and no other outcome does. The beacon
  node's is a committee seat's broadcast time, where it stops proving and
  discards a proof finished later. The validator client's is the slot's
  attestation time, where a block not yet handed to the node is
  abandoned; it is recorded where the budget is set (`propose`), since
  the proposal service holds only a monotonic deadline.

`duty::missed_deadline(key, cutoff)` is now the one way to record an
abandonment, so the cutoff cannot be left out. pq.context documents each
role's cutoff policy, as the spec asks.

The lifecycle test fed hand-written schedules and workloads in shapes no
call site builds (and the spec's schema refuses), so it could not notice
a record drifting from the contract. It now announces the context a
beacon node does (`context_data`, split out of `start`) and uses each
call site's shapes, covers an abandoned duty, and with PQ_EVENTS_DUMP
writes its records as normalized JSON for the spec's schema and tools.
@pablodeymo pablodeymo changed the title feat(pq): pq-devnet-2 — ERC-8517 PQ keys, X_COMMITTEE_COUNTS rotation, eth.telemetry/0.3 events feat(pq): pq-devnet-2 — ERC-8517 PQ keys, X_COMMITTEE_COUNTS rotation, eth.telemetry/0.4 events Dec 2, 2026

This branch has not been deployed

No deployments
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.

1 participant