diff --git a/src/lean_spec/node/validator/service.py b/src/lean_spec/node/validator/service.py index 9744d171b..1c6d002ab 100644 --- a/src/lean_spec/node/validator/service.py +++ b/src/lean_spec/node/validator/service.py @@ -433,7 +433,7 @@ def _sign_block( # Sign the block root with the proposal key. block_root = hash_tree_root(block) - _, proposer_signature = self._sign_with_key( + proposer_signature = self._sign_with_key( validator_entry, block.slot, block_root, @@ -521,7 +521,7 @@ def _sign_attestation( raise ValueError(f"No secret key for validator {validator_index}") # Sign the attestation data root with the attestation key. - _, signature = self._sign_with_key( + signature = self._sign_with_key( validator_entry, attestation_data.slot, hash_tree_root(attestation_data), @@ -540,7 +540,7 @@ def _sign_with_key( slot: Slot, message: Bytes32, key_field: Literal["attestation_secret_key", "proposal_secret_key"], - ) -> tuple[ValidatorEntry, Signature]: + ) -> Signature: """ Prepare an XMSS key for the given slot, sign, and update the registry. @@ -557,7 +557,7 @@ def _sign_with_key( key_field: Which secret key field to use and advance. Returns: - Tuple of (updated entry, signature). + The signature over the message. """ scheme = TARGET_SIGNATURE_SCHEME secret_key = getattr(validator_entry, key_field) @@ -577,7 +577,7 @@ def _sign_with_key( }, ) self.registry.add(updated_entry) - return updated_entry, signature + return signature def _is_synced_for_duties( self, diff --git a/tests/node/validator/test_service.py b/tests/node/validator/test_service.py index 792aa6af2..86e452f29 100644 --- a/tests/node/validator/test_service.py +++ b/tests/node/validator/test_service.py @@ -381,10 +381,10 @@ def test_proposal_key_updated_attestation_key_unchanged( assert stored.proposal_secret_key is advanced_proposal assert stored.attestation_secret_key is attestation_key - def test_returns_updated_entry_and_signature( + def test_returns_signature( self, sync_service: SyncService, key_manager: XmssKeyManager ) -> None: - """Return value is (updated ValidatorEntry, Signature) — both fields correct.""" + """Return value is the signature produced by the scheme.""" service, _, validator_entry, attestation_key, _ = self._setup(sync_service, key_manager) advanced = MagicMock(name="adv") mock_signature = MagicMock(name="ret_sig") @@ -396,12 +396,11 @@ def test_returns_updated_entry_and_signature( scheme.advance_preparation.return_value = advanced scheme.sign.return_value = mock_signature - returned_entry, returned_signature = service._sign_with_key( + returned_signature = service._sign_with_key( validator_entry, Slot(2), MagicMock(), "attestation_secret_key" ) assert returned_signature is mock_signature - assert returned_entry.attestation_secret_key is advanced class TestValidatorServiceBasic: