|
7 | 7 |
|
8 | 8 | from __future__ import annotations |
9 | 9 |
|
10 | | -import logging |
11 | 10 | from typing import ClassVar, Mapping, Self |
12 | 11 |
|
13 | 12 | from pydantic import model_validator |
@@ -198,19 +197,16 @@ def make_fixture(self) -> Self: |
198 | 197 | # Test states use placeholder pubkeys. |
199 | 198 | # We must replace them with the key manager's actual keys. |
200 | 199 | # Otherwise signature verification will fail. |
201 | | - updated_validators = [ |
202 | | - validator.model_copy( |
| 200 | + updated_validators = [] |
| 201 | + for i, validator in enumerate(self.anchor_state.validators): |
| 202 | + idx = ValidatorIndex(i) |
| 203 | + validator = validator.model_copy( |
203 | 204 | update={ |
204 | | - "attestation_pubkey": key_manager[ |
205 | | - ValidatorIndex(i) |
206 | | - ].attestation_public.encode_bytes(), |
207 | | - "proposal_pubkey": key_manager[ |
208 | | - ValidatorIndex(i) |
209 | | - ].proposal_public.encode_bytes(), |
| 205 | + "attestation_pubkey": key_manager[idx].attestation_public.encode_bytes(), |
| 206 | + "proposal_pubkey": key_manager[idx].proposal_public.encode_bytes(), |
210 | 207 | } |
211 | 208 | ) |
212 | | - for i, validator in enumerate(self.anchor_state.validators) |
213 | | - ] |
| 209 | + updated_validators.append(validator) |
214 | 210 |
|
215 | 211 | # Updating validators changes the state root. |
216 | 212 | # We must also update the anchor block to match. |
@@ -299,26 +295,18 @@ def make_fixture(self) -> Self: |
299 | 295 | if step.block.gossip_proposer_attestation: |
300 | 296 | proposer_index = block.proposer_index |
301 | 297 | proposer_att_data = store.produce_attestation_data(block.slot) |
302 | | - try: |
303 | | - proposer_gossip_att = SignedAttestation( |
304 | | - validator_id=proposer_index, |
305 | | - data=proposer_att_data, |
306 | | - signature=key_manager.sign_attestation_data( |
307 | | - proposer_index, proposer_att_data |
308 | | - ), |
309 | | - ) |
310 | | - store = store.on_gossip_attestation( |
311 | | - proposer_gossip_att, |
312 | | - scheme=LEAN_ENV_TO_SCHEMES[self.lean_env], |
313 | | - is_aggregator=True, |
314 | | - ) |
315 | | - except Exception as e: |
316 | | - logging.warning( |
317 | | - "Proposer gossip attestation failed (slot=%s): %s", |
318 | | - block.slot, |
319 | | - e, |
320 | | - exc_info=True, |
321 | | - ) |
| 298 | + proposer_gossip_att = SignedAttestation( |
| 299 | + validator_id=proposer_index, |
| 300 | + data=proposer_att_data, |
| 301 | + signature=key_manager.sign_attestation_data( |
| 302 | + proposer_index, proposer_att_data |
| 303 | + ), |
| 304 | + ) |
| 305 | + store = store.on_gossip_attestation( |
| 306 | + proposer_gossip_att, |
| 307 | + scheme=LEAN_ENV_TO_SCHEMES[self.lean_env], |
| 308 | + is_aggregator=True, |
| 309 | + ) |
322 | 310 |
|
323 | 311 | case AttestationStep(): |
324 | 312 | # Process a gossip attestation. |
|
0 commit comments