@@ -117,13 +117,16 @@ pub struct SubscriptionSlots {
117117#[ derive( Copy , Clone , Debug ) ]
118118pub struct SelectionProofConfig {
119119 pub lookahead_slot : u64 ,
120- pub computation_offset : Duration , // The seconds to compute the selection proof before a slot
121- pub selections_endpoint : bool , // whether to call the selections endpoint, true for DVT with middleware
122- pub parallel_sign : bool , // whether to sign the selection proof in parallel, true in distributed mode
120+ /// The seconds to compute the selection proof before a slot.
121+ pub computation_offset : Duration ,
122+ /// Whether to call the selections endpoint, true for DVT with middleware.
123+ pub selections_endpoint : bool ,
124+ /// Whether to sign the selection proof in parallel, true in distributed mode.
125+ pub parallel_sign : bool ,
123126}
124127
125- impl SelectionProofConfig {
126- // Create a default associated function to be passed in DutiesServiceBuilder::new()
128+ /// The default config for selection proofs covers the non-DVT case.
129+ impl Default for SelectionProofConfig {
127130 fn default ( ) -> Self {
128131 Self {
129132 lookahead_slot : 0 ,
@@ -175,11 +178,18 @@ async fn make_selection_proof<S: ValidatorStore + 'static, T: SlotClock>(
175178 } )
176179 . await ;
177180
178- let response_data = & middleware_response
181+ let response_data = middleware_response
179182 . map_err ( |e| {
180183 Error :: FailedToProduceSelectionProof ( ValidatorStoreError :: Middleware ( e. to_string ( ) ) )
181184 } ) ?
182- . data [ 0 ] ;
185+ . data
186+ . pop ( )
187+ . ok_or_else ( || {
188+ Error :: FailedToProduceSelectionProof ( ValidatorStoreError :: Middleware ( format ! (
189+ "attestation selection proof - empty response for validator {}" ,
190+ duty. validator_index
191+ ) ) )
192+ } ) ?;
183193
184194 debug ! (
185195 "validator_index" = response_data. validator_index,
@@ -188,7 +198,7 @@ async fn make_selection_proof<S: ValidatorStore + 'static, T: SlotClock>(
188198 "full selection proof" = ?response_data. selection_proof,
189199 "Received selection from middleware"
190200 ) ;
191- SelectionProof :: from ( response_data. selection_proof . clone ( ) )
201+ SelectionProof :: from ( response_data. selection_proof )
192202 } else {
193203 validator_store
194204 . produce_selection_proof ( duty. pubkey , duty. slot )
0 commit comments