@@ -144,12 +144,6 @@ impl BlockChainServer {
144144 // Produce attestation data once for all validators
145145 let attestation_data = self . store . produce_attestation_data ( slot) ;
146146
147- // Hash the attestation data for signing
148- let message_hash = attestation_data. tree_hash_root ( ) ;
149-
150- // Epoch for signing
151- let epoch = slot as u32 ;
152-
153147 // For each registered validator, produce and publish attestation
154148 for validator_id in self . key_manager . validator_ids ( ) {
155149 // Skip if this validator is the slot proposer
@@ -158,14 +152,16 @@ impl BlockChainServer {
158152 continue ;
159153 }
160154
155+ // Hash the attestation data for signing
156+ let attestation = Attestation {
157+ data : attestation_data. clone ( ) ,
158+ validator_id,
159+ } ;
160+
161161 // Sign the attestation
162- let Ok ( signature) = self
163- . key_manager
164- . sign_attestation ( validator_id, epoch, & message_hash)
165- . inspect_err (
166- |err| error ! ( %slot, %validator_id, %err, "Failed to sign attestation" ) ,
167- )
168- else {
162+ let Ok ( signature) = self . key_manager . sign_attestation ( & attestation) . inspect_err (
163+ |err| error ! ( %slot, %validator_id, %err, "Failed to sign attestation" ) ,
164+ ) else {
169165 continue ;
170166 } ;
171167
@@ -218,11 +214,9 @@ impl BlockChainServer {
218214 } ;
219215
220216 // Sign the proposer's attestation
221- let message_hash = proposer_attestation. data . tree_hash_root ( ) ;
222- let epoch = slot as u32 ;
223217 let Ok ( proposer_signature) = self
224218 . key_manager
225- . sign_attestation ( validator_id , epoch , & message_hash )
219+ . sign_attestation ( & proposer_attestation )
226220 . inspect_err (
227221 |err| error ! ( %slot, %validator_id, %err, "Failed to sign proposer attestation" ) ,
228222 )
@@ -233,9 +227,8 @@ impl BlockChainServer {
233227 // Assemble flat signature list: [attestation_sig_0, ..., attestation_sig_n, proposer_sig]
234228 let mut signatures = attestation_signatures;
235229 signatures. push ( proposer_signature) ;
236- let block_signatures: BlockSignatures = signatures
237- . try_into ( )
238- . expect ( "signatures within limit" ) ;
230+ let block_signatures: BlockSignatures =
231+ signatures. try_into ( ) . expect ( "signatures within limit" ) ;
239232
240233 // Assemble SignedBlockWithAttestation
241234 let signed_block = SignedBlockWithAttestation {
0 commit comments