Skip to content

Refuse a PQ keystore of a remote key before registering it - #1004

Open
tcoratger wants to merge 1 commit into
lambdaclass:pq-devnet-2from
tcoratger:fix/pq-remote-dup
Open

tcoratger wants to merge 1 commit into
lambdaclass:pq-devnet-2from
tcoratger:fix/pq-remote-dup

Conversation

@tcoratger

Copy link
Copy Markdown

Description / Motivation

Every leanXMSS signature spends a one-time leaf, and two messages signed at one leaf expose the key.
POST /eth/v1/keystores refuses a keystore whose key a remote signer already holds, with duplicate.
For a PQ keystore, that check ran after pq::derive_and_register_account had derived the key and registered it.
The refused key stayed signable in this process, beside the remote signer: two signers for one key, each spending its leaves.

What Changed

  • keystores.rs: prepare_import computes the key's handle from the keystore's declared pubkey, runs the duplicate check, and only then derives and registers a PQ key.
  • keystore.rs: the ERC-8519 test keystore is visible to the other test modules.

The BLS path is unchanged: deriving its pubkey registers nothing.

Tests Added / Run

  • a_pq_import_of_a_remote_key_registers_nothing: the import is duplicate, the key is not in the PQ registry, and the remote entry survives.
    It fails with the check back after registration.
  • cargo test --profile release-fast -p ethlambda-validator --lib: 774 passed.
  • cargo fmt --all --check and cargo clippy --profile release-fast -p ethlambda-validator --all-targets -- -D warnings: clean.

🤖 Generated with Claude Code

The remote-signer duplicate check ran after the PQ key was derived and
registered, so a refused import left the key signable locally beside its
remote signer: two signers spending one key's one-time leaves.
The check now runs first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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