Repository navigation
feat(pq): follow consensus-specs pq at 66f143ec (pq-devnet-2) - #975
pablodeymo wants to merge 3 commits into
Conversation
PQ preregistrations store expiry_epoch (current epoch plus PREREGISTRATION_EXPIRY_EPOCHS) instead of expiry_slot. A request is a no-op when the list is full or already holds a record for the key, expired or not: only the epoch sweep frees either, and the sweep compares against the latest payload bid's epoch. EIP-8483: a validator registers only with compounding credentials and before initiating an exit, only the first 32 bytes of its PQ data must be new, an exiting builder cannot register, and an exit, a consolidation or a builder exit removes the registration. A full parent from before the fork is checked against gloas's ExecutionRequests root. The gloas gossip rules that changed in the same range are not taken: PQ gossip follows the pinned gloas rules (docs/spec_deviations.md).
|
/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.
DetailsM2.
Pre-existing (real, but already on the base branch): 1
Housekeeping (not security): 1Stale docs, missing tests, leftovers and inconsistencies, from a separate cheap model. Not checked by the judge.
Cost of this review: ~$4.42 of a $30 budget (estimated from token counts). |
Addresses the security review of PR #975. M2: `upgrade_to_eip8483`'s doc still said the specification leaves a full pre-fork parent to the coordinated upgrade and that nothing handles it. This PR's `eip8483::process_parent_execution_payload` does: such a parent's requests are verified against gloas's `ExecutionRequests` and must carry no PQ registration. The doc now says so. Pre-existing M1 (PQ rejects a full pre-fork parent): not a change of rule. consensus-specs `pq` at `66f143ec` says in a note that every full parent's requests are verified against the PQ type, and gives PQ no branch like EIP-8483's, so the code is the specification as written, and accepting such a parent here alone would follow a chain no other client does. `pq::process_parent_execution_payload` and `upgrade_to_pq` now record that, and that the first PQ block can take a pre-fork parent only as EMPTY. A network that is PQ from genesis never meets the case. Housekeeping: the "Interop at pq-devnet-1's spec" item under "What remains" names pq-devnet-2 and `66f143ec`, and no longer calls the genesis and key derivation TBD: the pq-devnet-2 notes settle both.
|
/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. Reject incompatible PQ snapshots before interpreting slot deadlines as epochs (low, consensus/state)
Cost of this review: ~$4.50 of a $30 budget (estimated from token counts). |
Motivation
pq-devnet-2's spec sheet names consensus-specs
pqat66f143ec.pq-devnet-2is at4c296784plusX_COMMITTEE_COUNTS. Two things in between change the state a node computes:f21ace42..c8608e56): a record now storesexpiry_epoch, notexpiry_slot, so the state root differs from the first preregistration on.4e25f53a,a0d94fdc): who may register, what must be unique, and removal on exit.Changes
PQ state transition
ValidatorPreregistrationandBuilderPreregistrationcarryexpiry_epoch = get_current_epoch(state) + PREREGISTRATION_EXPIRY_EPOCHS. The preset is 8192 epochs on mainnet and 8 on minimal (it wasPREREGISTRATION_EXPIRY_SLOTS, 262144 and 64).PREREGISTRATIONS_LIMITrecords or one for the key. Both used to count only unexpired records, and an expired record was replaced in place. Now only the sweep frees either.is_active_*_preregistrationandget_active_*_preregistrationare gone. Deposits and builder deposits look the record up withget_{validator,builder}_preregistration, which does not check expiry.process_preregistration_expirykeeps a record whilecompute_epoch_at_slot(state.latest_execution_payload_bid.slot) < expiry_epoch.EIP-8483 state transition
0x02) credentials and only before it has initiated an exit. Only the first 32 bytes of its PQ data must be unregistered (both halves had to be).initiate_validator_exit,initiate_validator_consolidationandinitiate_builder_exitremove the registration. The removal is a no-op on every other fork, PQ included, whose state has no such list.process_parent_execution_payloadverifies a full parent from beforeEIP8483_FORK_EPOCHagainst gloas'sExecutionRequestsroot, and requires it to carry no PQ registration.Not changed
docs/spec_deviations.md("PQ gossip is gloas's rules with the PQ lines applied") already records that PQ gossip follows the pinned gloas rules, and now lists these. They are IGNOREs, or REJECTs of payloads the execution client refuses anyway, so an honest network sees no difference. A wrong block-hash computation would refuse every valid payload, and nothing in the repository can check one yet.Docs
The pin moves to
66f143ecin module docs,CLAUDE.md,docs/beacon_pq.mdanddocs/spec_deviations.md.docs/beacon_pq.mdalso notes that the pyspec now signs fixtures with real leanXMSS keys (c3e76688), which the spec-test binary, with verification off, cannot judge yet.Compatibility
The PQ state's SSZ shape is unchanged (one
uint64field renamed), soDB_VERSIONstays. A data directory that already holds preregistrations would read their slot deadline as an epoch; this only matters to a network that stored one under the old rule.Testing
New unit tests:
expiry_epochmid-epoch; a second request for a stored key, expired or not, changes nothing; a full list admits nothing and one below the limit does; the sweep follows the latest payload's epoch across empty epochs, keeps order, and frees the key.They match the cases of the pyspec's own tests for these functions at
66f143ec, read by hand (test_process_preregistration_expiry.py,test_process_validator_preregistration_request.py, the EIP-8483block_processingtests).Run locally, all green:
cargo test --locked --profile release-fastover the consensus crates (ethlambda-types,ethlambda-fork-choice,ethlambda-state-transition,ethlambda-blockchain,ethlambda-crypto,ethlambda-ssz-tree), default preset.cargo test --profile release-fast --lib --features preset-minimalforethlambda-typesandethlambda-state-transition.cargo check --features beacon-spec-tests --testsforethlambda-state-transitionandethlambda-blockchain(the spec-test targets compile).make lint,cargo fmt --all --check.Not run: the pyspec's reference fixtures. No release ships PQ or EIP-8483 fixtures, and generating them needs the pyspec toolchain. To check this PR against them:
then unpack
reftests/tests/minimal/{pq,eip8483}underconsensus-spec-tests/tests/minimal/and runmake test-beacon-minimal.