@@ -106,11 +106,12 @@ def _serialize_model(self, serializer: Any) -> Dict[str, Any]:
106106 """
107107 # Get default serialization
108108 data = serializer (self )
109+ signed_block = self .signed_block_with_attestation
109110
110111 if self .anchor_state is not None :
111112 # Collect attester pubkeys for all attestations in the block body
112113 attester_pubkeys = []
113- for attestation in self . signed_block_with_attestation .message .block .body .attestations :
114+ for attestation in signed_block .message .block .body .attestations :
114115 validator_index = ValidatorIndex (int (attestation .validator_id ))
115116 validator = self .anchor_state .validators [int (validator_index )]
116117 attester_pubkeys .append (
@@ -120,18 +121,16 @@ def _serialize_model(self, serializer: Any) -> Dict[str, Any]:
120121 )
121122
122123 # Get proposer pubkey
123- proposer_index = ValidatorIndex (int (self . signed_block_with_attestation .message .block .proposer_index ))
124+ proposer_index = ValidatorIndex (int (signed_block .message .block .proposer_index ))
124125 proposer = self .anchor_state .validators [int (proposer_index )]
125126 proposer_pubkey = (
126- proposer .pubkey .hex ()
127- if isinstance (proposer .pubkey , bytes )
128- else proposer .pubkey
127+ proposer .pubkey .hex () if isinstance (proposer .pubkey , bytes ) else proposer .pubkey
129128 )
130129
131- data ["blockWithAttestation" ] = self . signed_block_with_attestation .message .model_dump (mode = "json" )
130+ data ["blockWithAttestation" ] = signed_block .message .model_dump (mode = "json" )
132131 data ["attester_pubkeys" ] = attester_pubkeys
133132 data ["proposer_pubkey" ] = proposer_pubkey
134- data ["signedBlockWithAttestation" ] = self . signed_block_with_attestation .model_dump (mode = "json" )
133+ data ["signedBlockWithAttestation" ] = signed_block .model_dump (mode = "json" )
135134 data .pop ("container" , None )
136135 data .pop ("anchorState" , None )
137136
@@ -161,12 +160,12 @@ def make_fixture(self) -> SignedBlockWithAttestationTest:
161160 4. Verifying signatures against validator public keys
162161 5. Checking that valid/invalid expectation is met
163162
164- Returns
163+ Returns:
165164 -------
166165 SignedBlockWithAttestationTest
167166 The validated fixture with properly signed block.
168167
169- Raises
168+ Raises:
170169 ------
171170 AssertionError
172171 If signature verification doesn't match expected validity.
@@ -200,11 +199,12 @@ def make_fixture(self) -> SignedBlockWithAttestationTest:
200199 )
201200
202201 # Build signed block with correct signatures
203- signed_block = self ._build_signed_block (self .signed_block_with_attestation .message , key_manager )
204- self .signed_block_with_attestation = signed_block
202+ self .signed_block_with_attestation = self ._build_signed_block (
203+ self .signed_block_with_attestation .message , key_manager
204+ )
205205
206206 # Verify all signatures in the block
207- is_valid = signed_block .verify_signatures (self .anchor_state )
207+ is_valid = self . signed_block_with_attestation .verify_signatures (self .anchor_state )
208208
209209 if self .valid and not is_valid :
210210 raise AssertionError (
@@ -234,7 +234,7 @@ def _build_signed_block(
234234 key_manager : XmssKeyManager
235235 Key manager for generating XMSS signatures.
236236
237- Returns
237+ Returns:
238238 -------
239239 SignedBlockWithAttestation
240240 The block with valid XMSS signatures.
0 commit comments