Repository navigation
Conversation
A PQ signature takes its key from the registry, claims its leaf, then signs for up to seconds, without the store's lock. A keystore delete could answer while such a signature was still being made, so a signature of the key appeared after the response. Each signature is now counted from its key's lookup until it exists. The lookup and the count happen under the registry's read lock, so a later removal from the registry cannot miss a counted signature. The delete waits, on the blocking pool, for the signatures counted for each key that left the store. The leaves those signatures claimed stay in the leaf record. 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
A PQ signature takes its key from the registry, claims its leaf, then signs for up to seconds, outside the store's lock.
DELETE /eth/v1/keystorescould answer while such a signature was still being made.The operator was then told the key was gone while this process still produced a signature with it.
What Changed
pq.rs: each signature is counted from its key's lookup until it exists.wait_for_signaturesblocks until the signatures counted for a key exist;finish_signaturesruns it on the blocking pool.keystores.rs: a delete waits for the signatures counted for each key that left the store, before the export and the response.Interaction with open PRs
judge_delete, so no signature of it starts after the delete.This PR covers the signatures that started before; together, no signature of a deleted key exists after the delete answers.
Both edit
delete's neighbourhood inkeystores.rsandpq.rs, so whichever lands second may need a rebase.For reviewers
definitions_lock.A bound would answer with a signature still being made, which is what this removes; one signature takes at most a bottom-tree build.
Tests Added / Run
a_delete_waits_for_the_pq_signature_under_way: a delete with a signature held answers only after it is released.a_wait_returns_once_the_keys_signatures_under_way_end: two signatures of one key; the wait returns only after both; the claimed leaf stays spent.a_wait_ignores_another_keys_signaturesanda_batch_counts_its_signature_until_it_exists(throughsign_batch).delete, ending the count before the signature, or dropping a key's whole count on one signature each make a test fail.cargo test --locked --profile release-fast -p ethlambda-validator: 777 passed; the lib binary passed 10 runs in a row.cargo fmt --all -- --checkandcargo clippy --locked --profile release-fast -p ethlambda-validator --all-targets -- -D warnings: clean.🤖 Generated with Claude Code