Repository navigation
Conversation
… roles KeyManager loaded each validator's attestation and proposal secret keys without checking them, and annotated_validators.yaml entries naming neither an attester nor a proposer file were loaded as one key for both roles. leanSpec's ValidatorRegistry rejects one key for both roles: a validator signs a proposal and an attestation in the same slot, and XMSS is a stateful one-time signature. A key that differs from the registry also makes every signature fail verification at peers. SecretKey now derives its public key, and loading checks each validator's two keys differ and equal its entry in the anchor state's registry. A single-key manifest entry is rejected.
With --hash-sig-key-dir set, a key that failed to load or did not match the validator registry, or a missing key directory, only logged a warning and the node ran with zero signatures, so a misconfigured validator kept running and produced nothing peers accept. Exit with the error instead. Without --hash-sig-key-dir the node still runs with zero signatures, as before.
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.
Bug
KeyManager(validator/src/keys.rs) decodes each validator's attestation and proposal secret keys and stores them. It never compares them with the validator'sattestation_pubkey/proposal_pubkeyin the state's registry. The manifest'spubkey_hexis parsed and never read.ValidatorConfig::load_from_file(validator/src/lib.rs) accepts a "single-key format": an entry whose file names neither an attester nor a proposer key is used for both roles.main.rs, if keys from--hash-sig-key-dirfail to load, the node logs a warning and keeps running with zero signatures.Problem
ValidatorRegistryraisesValueErrorwhen a validator's attestation and proposal keys are the same (src/lean_spec/node/validator/registry.py:217-226). XMSS is a stateful one-time signature, and a validator signs a proposal and an attestation in the same slot, so sharing one key reuses one-time state.Change
Commit 1: check the keys.
SecretKey::public_key()derives the public key using leanVM'sXmssSecretKey::public_key().ValidatorService::new_with_keys_and_aggregatornow takes the anchor state's validators. After loading each validator's keys, it callsKeyManager::check_keys, which fails when:Commit 2: refuse to start.
--hash-sig-key-diris given and its keys fail to load or fail a check, or the directory is missing, the node exits with the error. This follows the existing checkpoint-verification pattern ("Refusing to start").--hash-sig-key-dirkeeps the zero-signature mode.Tests
check_keys_matches_registry_and_distinct_roles: matching keys pass; swapped roles and a proposal key that is not in the registry are both rejected.check_keys_rejects_one_key_for_both_roles.test_load_from_file_rejects_single_key_entry.Checks run:
cargo test -p validator --releasepasses.cargo fmt --checkpasses.cargo build --release --bin lean_clientpasses.I did not run the full workspace
make test.Manual run against a local devnet-5 quickstart genesis (validator 3):
The real keys start normally.
With validator 3's attester and proposer key files swapped, the node exits: