Skip to content

perf(pq): sign a proposal's envelope alongside its block - #909

Merged
MegaRedHand merged 1 commit into
pq-devnet-0from
pq/sign-envelope-with-block
Nov 26, 2026
Merged

MegaRedHand merged 1 commit into
pq-devnet-0from
pq/sign-envelope-with-block

Conversation

@MegaRedHand

@MegaRedHand MegaRedHand commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

🗒️ Description / Motivation

A PQ proposal signed its block, published it, and only then signed the envelope, so the envelope always waited one more leanXMSS signature after the block. That is about 0.3 s of a core, and sometimes several times that, since the signature's cost is geometric (see #906).

On pq-devnet-0 the gap between Published a PQ block and Published a PQ execution payload envelope was 0.78 s in slot 23740 and 0.12 s in slot 23748. The envelope gates everything that needs the payload: the next proposer's parent, the PTC's payload_present, and the execution client.

produce_pq_block hands back the block and its envelope together. So the envelope's signing root is known as soon as the block's, and its signature need not wait.

What Changed

  • crates/validator/src/proposal.rs (propose_pq)
    • Once the block is recorded in slashing protection, both signatures start at once, each on its own task (pq::sign on tokio's blocking pool, signing on the rayon pool).
    • The block is published as soon as its own signature is done, then the envelope as soon as its signature is.
    • The doc comment says so.

Correctness / Behavior Guarantees

  • Slashing protection is unchanged. The block is recorded before either signature exists. Each leaf is recorded in the leanXMSS leaf record before its signature exists, as before. The two claims are separate flushes, serialized on the record's lock.
  • The block still goes out first. It never waits for the envelope's signature.
  • A failed block costs only the envelope leaf. If the block's signature or publish fails, the envelope may already be signed and is dropped. That spends only the slot's envelope leaf, which no other message can use. No second block can be signed for the slot either way.
  • An envelope failure is still logged and counted, not the proposal's, now including a signing task that died.

Tests Added / Run

  • No unit test covers the PQ proposal path: the mock node does not produce PQ blocks, and a proposal needs a VRF tree.
  • Exercised on the local A/B devnet: proposals and envelopes published and imported on both sides. See below.
  • make fmt, make lint clean.

Related Issues / PRs

Local devnet (all four PRs together, A/B)

Run with ethereum-package pq (7a29d69e), PQ at genesis, on an arm64 Mac:

Five epochs ran, and the three nodes justified and finalized together (just=3 fin=2 at slot 132, one head). Justification needs more than 107 of the 160 votes, so the new client's streamed votes counted. There were no warnings on any node beyond startup notices, and zero signing, attestation, PTC or envelope failures on either client.

new baseline
vote delay (per vote) p50 / p90 0.49 s / 0.88 s 0.70 s / 1.05 s
submissions per slot (median) 2 1
first PTC publish minus last attestation, p50 (min) +0.29 s (+0.03 s) +0.01 s (−0.61 s)
envelope after its block, p50 / mean / max 0.05 / 0.11 / 0.41 s (44 proposals) 0.15 / 0.21 / 0.69 s (55)
next epoch's PTC duties fetched after the slot's duties, +6.2–6.5 s at the refresh, +0.14–0.18 s

On this small network each client signs only about two votes per slot, so the streaming gain is smaller than on pq-devnet-0's twenty. The node there answers the early PTC request in 0.15 s, so the 2 s state advance only shows at pq-devnet-0's 10,000 validators. Both effects are expected to be larger on the real devnet.

A PQ proposal signed the block, published it, and only then signed the
envelope, so the envelope waited a whole leanXMSS signature (about 0.3 s of
a core, sometimes several times that) after the block: 0.78 s in
pq-devnet-0's slot 23740, 0.12 s in slot 23748. The node hands back the
block and its envelope together, so the envelope's message is known as soon
as the block's.

Both signatures now start once the block is recorded in slashing
protection, each on its own core. The block is published as soon as its
own signature is done, then the envelope. An envelope signed for a block
that then fails costs only the slot's envelope leaf, which no other message
can use.
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