From c5a6bd5af6812a840d1775668b301e93312bb99d Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Thu, 18 Jun 2026 21:28:12 +0200 Subject: [PATCH] refactor(testing): build keyed genesis validators by comprehension The keyed branch used an imperative append loop while the unkeyed branch was a comprehension. Mirror the two so the paths read alike. Genesis state byte-identical. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../testing/src/consensus_testing/genesis.py | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/testing/src/consensus_testing/genesis.py b/packages/testing/src/consensus_testing/genesis.py index 1647364af..2b43634e1 100644 --- a/packages/testing/src/consensus_testing/genesis.py +++ b/packages/testing/src/consensus_testing/genesis.py @@ -34,19 +34,18 @@ def build_genesis_state( f"Not enough keys: need {num_validators} validators " f"but the key manager has only {len(key_manager)} keys" ) - validators = [] - for validator_position in range(num_validators): - validator_index = ValidatorIndex(validator_position) - attestation_public_key, proposal_public_key = key_manager.get_public_keys( - validator_index - ) - validators.append( - Validator( - attestation_public_key=Bytes52(attestation_public_key.encode_bytes()), - proposal_public_key=Bytes52(proposal_public_key.encode_bytes()), - index=validator_index, - ) + validators = [ + Validator( + attestation_public_key=Bytes52( + key_manager.get_public_keys(ValidatorIndex(validator_index))[0].encode_bytes() + ), + proposal_public_key=Bytes52( + key_manager.get_public_keys(ValidatorIndex(validator_index))[1].encode_bytes() + ), + index=ValidatorIndex(validator_index), ) + for validator_index in range(num_validators) + ] else: validators = [ Validator(