Repository navigation
Conversation
The PQ key registry only grew. A key registered by an import that then failed, or deleted through the keymanager API, still signed every duty of its handle. A remote signer given that key later would sign beside it, at the same one-time leaves. An import that does not load a key it registered now unregisters it, and a delete unregisters the key. The leaf record is left as it is, so a key registered again in this process signs none of its spent leaves. The PQ attestation test and a keymanager delete test now use keys that no other test registers PQ keys under or deletes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Every leanXMSS signature spends a one-time leaf, and two messages signed at one leaf expose the key.
The PQ key registry in
pq.rsonly grew, and the duties sign PQ through it by handle, whatever the store holds.A key stayed registered, and signing, in two cases:
DELETE /eth/v1/keystores.Neither key is in the store, so a later
POST /eth/v1/remotekeysof it is accepted.The key then has two signers, each spending its leaves.
What Changed
pq.rs:unregisterremoves a key from the registry.It leaves the leaf record alone, so a key registered again in this process signs none of its spent leaves.
keystores.rs: an import that registered a key it did not hold, and then fails, unregisters it.This covers the persist step, the slashing-protection step and a key a remote signer holds.
A failed re-import of a key the store holds leaves it signing.
keystores.rs: a delete through/eth/v1/keystoresunregisters the key along with its removal from the store.Interaction with open PRs
This PR also unregisters the key on that path, so the two overlap there without contradicting each other; both edit
prepare_import, so whichever lands second needs a rebase.prepare_importand makes the samepub(crate)change tokeystore::tests.Tests Added / Run
an_unregistered_key_signs_nothing_and_keeps_its_leaves: afterunregisterthe key signs nothing, and once it is registered again, a leaf it signed refuses another root.a_failed_pq_import_leaves_its_key_unregistered: a failed keystore write, a failed slashing-protection write and a remote-held key each leave the key unregistered.a_failed_pq_reimport_of_a_held_key_keeps_it_signing: both failure steps leave a held key registered.a_deleted_pq_key_stops_signing_and_keeps_its_leaves: a deleted key signs nothing, and its spent leaf stays spent after a new import.cargo test --profile release-fast -p ethlambda-validator --lib: 777 passed, 20 runs in a row.cargo fmt --all --checkandcargo clippy --profile release-fast -p ethlambda-validator --all-targets -- -D warnings: clean.🤖 Generated with Claude Code