@@ -232,8 +232,14 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
232232 }
233233 }
234234
235+ pub async fn run ( self ) -> Result < ( ) > {
236+ self . run_internal ( ) . await ;
237+
238+ Ok ( ( ) )
239+ }
240+
235241 #[ expect( clippy:: too_many_lines) ]
236- pub async fn run ( mut self ) -> Result < ( ) > {
242+ async fn run_internal ( mut self ) {
237243 loop {
238244 let mut slasher_to_validator_rx = self
239245 . slasher_to_validator_rx
@@ -244,24 +250,28 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
244250 select ! {
245251 message = self . internal_rx. select_next_some( ) => match message {
246252 InternalMessage :: DoppelgangerProtectionResult ( result) => {
247- result?;
253+ if let Err ( error) = result {
254+ panic!( "Doppelganger protection error: {error}" ) ;
255+ }
248256 }
249257 } ,
250258
251259 message = self . fork_choice_rx. select_next_some( ) => match message {
252260 ValidatorMessage :: Tick ( wait_group, tick) => {
253- self . handle_tick( wait_group, tick) . await ?;
261+ if let Err ( error) = self . handle_tick( wait_group, tick) . await {
262+ panic!( "error while handling tick: {error:?}" ) ;
263+ }
254264 }
255265 ValidatorMessage :: FinalizedEth1Data ( finalized_eth1_data, deposit_requests_start_index) => {
256- self . block_producer. finalize_deposits( finalized_eth1_data, deposit_requests_start_index) ? ;
266+ self . block_producer. finalize_deposits( finalized_eth1_data, deposit_requests_start_index) ;
257267 } ,
258268 ValidatorMessage :: Head ( wait_group, head) => {
259269 if let Some ( validator_to_liveness_tx) = & self . validator_to_liveness_tx {
260270 let state = self . controller. state_by_chain_link( & head) ;
261271 ValidatorToLiveness :: Head ( head. block. clone_arc( ) , state) . send( validator_to_liveness_tx) ;
262272 }
263273
264- self . attest_gossip_block( & wait_group, head) . await ? ;
274+ self . attest_gossip_block( & wait_group, head) . await ;
265275 }
266276 ValidatorMessage :: ValidAttestation ( wait_group, attestation) => {
267277 self . attestation_agg_pool
@@ -283,7 +293,13 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
283293 let slot_head = self . safe_slot_head( slot) . await ;
284294
285295 if let Some ( slot_head) = slot_head {
286- let proposer_index = slot_head. proposer_index( ) ?;
296+ let proposer_index = match slot_head. proposer_index( ) {
297+ Ok ( proposer_index) => proposer_index,
298+ Err ( error) => {
299+ error!( "failed to compute proposer index while preparing execution payload: {error:?}" ) ;
300+ continue ;
301+ }
302+ } ;
287303
288304 let block_build_context = self . block_producer. new_build_context(
289305 slot_head. beacon_state. clone_arc( ) ,
@@ -339,10 +355,16 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
339355
340356 gossip_message = self . p2p_to_validator_rx. select_next_some( ) => match gossip_message {
341357 P2pToValidator :: AttesterSlashing ( slashing, gossip_id) => {
342- let outcome = self
358+ let outcome = match self
343359 . block_producer
344360 . handle_external_attester_slashing( * slashing. clone( ) )
345- . await ?;
361+ . await {
362+ Ok ( outcome) => outcome,
363+ Err ( error) => {
364+ warn!( "failed to handle attester slashing: {error}" ) ;
365+ continue ;
366+ }
367+ } ;
346368
347369 if matches!( outcome, PoolAdditionOutcome :: Accept ) {
348370 self . event_channels. send_attester_slashing_event( & slashing) ;
@@ -351,10 +373,16 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
351373 self . handle_pool_addition_outcome_for_p2p( outcome, gossip_id) ;
352374 }
353375 P2pToValidator :: ProposerSlashing ( slashing, gossip_id) => {
354- let outcome = self
376+ let outcome = match self
355377 . block_producer
356378 . handle_external_proposer_slashing( * slashing)
357- . await ?;
379+ . await {
380+ Ok ( outcome) => outcome,
381+ Err ( error) => {
382+ warn!( "failed to handle proposer slashing: {error}" ) ;
383+ continue ;
384+ }
385+ } ;
358386
359387 if matches!( outcome, PoolAdditionOutcome :: Accept ) {
360388 self . event_channels. send_proposer_slashing_event( & slashing) ;
@@ -363,10 +391,16 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
363391 self . handle_pool_addition_outcome_for_p2p( outcome, gossip_id) ;
364392 }
365393 P2pToValidator :: VoluntaryExit ( voluntary_exit, gossip_id) => {
366- let outcome = self
394+ let outcome = match self
367395 . block_producer
368396 . handle_external_voluntary_exit( * voluntary_exit)
369- . await ?;
397+ . await {
398+ Ok ( outcome) => outcome,
399+ Err ( error) => {
400+ warn!( "failed to handle voluntary exit: {error}" ) ;
401+ continue ;
402+ }
403+ } ;
370404
371405 if matches!( outcome, PoolAdditionOutcome :: Accept ) {
372406 self . event_channels. send_voluntary_exit_event( & voluntary_exit) ;
@@ -447,7 +481,7 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
447481 }
448482 }
449483
450- complete => break Ok ( ( ) ) ,
484+ complete => break ,
451485 }
452486 }
453487 }
@@ -585,11 +619,19 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
585619 . as_ref ( )
586620 . map ( |metrics| metrics. validator_attest_tick_times . start_timer ( ) ) ;
587621
588- self . attest_and_start_aggregating ( & wait_group, & slot_head)
589- . await ?;
622+ if let Err ( error) = self
623+ . attest_and_start_aggregating ( & wait_group, & slot_head)
624+ . await
625+ {
626+ error ! ( "failed to produce and publish own attestations: {error:?}" ) ;
627+ }
590628
591- self . publish_sync_committee_messages ( & wait_group, & slot_head)
592- . await ?;
629+ if let Err ( error) = self
630+ . publish_sync_committee_messages ( & wait_group, & slot_head)
631+ . await
632+ {
633+ error ! ( "failed to produce and publish own sync_committee messages: {error:?}" ) ;
634+ }
593635 }
594636 TickKind :: Aggregate => {
595637 let _timer = self
@@ -757,13 +799,20 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
757799 }
758800 } ;
759801
760- let beacon_block_option = block_build_context
802+ let beacon_block_option = match block_build_context
761803 . build_blinded_beacon_block (
762804 randao_reveal,
763805 execution_payload_header_handle,
764806 local_execution_payload_handle,
765807 )
766- . await ?;
808+ . await
809+ {
810+ Ok ( block_opt) => block_opt,
811+ Err ( error) => {
812+ warn ! ( "failed to produce beacon block: {error}" ) ;
813+ return Ok ( ( ) ) ;
814+ }
815+ } ;
767816
768817 let Some ( (
769818 WithBlobsAndMev {
@@ -1261,13 +1310,13 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
12611310 }
12621311 }
12631312
1264- async fn attest_gossip_block ( & mut self , wait_group : & W , head : ChainLink < P > ) -> Result < ( ) > {
1313+ async fn attest_gossip_block ( & mut self , wait_group : & W , head : ChainLink < P > ) {
12651314 let Some ( last_tick) = self . last_tick else {
1266- return Ok ( ( ) ) ;
1315+ return ;
12671316 } ;
12681317
12691318 if !( last_tick. slot == head. slot ( ) && last_tick. is_before_attesting_interval ( ) ) {
1270- return Ok ( ( ) ) ;
1319+ return ;
12711320 }
12721321
12731322 let slot_head = SlotHead {
@@ -1283,19 +1332,25 @@ impl<P: Preset, W: Wait + Sync> Validator<P, W> {
12831332 // This noticeably improves rewards in Goerli.
12841333 // This is a deviation from the Honest Validator specification.
12851334 if Feature :: PublishAttestationsEarly . is_enabled ( ) {
1286- self . attest_and_start_aggregating ( wait_group, & slot_head)
1287- . await ?;
1335+ if let Err ( error) = self
1336+ . attest_and_start_aggregating ( wait_group, & slot_head)
1337+ . await
1338+ {
1339+ error ! ( "failed to produce and publish own attestations: {error:?}" ) ;
1340+ }
12881341 }
12891342
12901343 // Publish sync committee messages late by default.
12911344 // This noticeably improves rewards in Goerli.
12921345 // This is a deviation from the Honest Validator specification.
12931346 if Feature :: PublishSyncCommitteeMessagesEarly . is_enabled ( ) {
1294- self . publish_sync_committee_messages ( wait_group, & slot_head)
1295- . await ?;
1347+ if let Err ( error) = self
1348+ . publish_sync_committee_messages ( wait_group, & slot_head)
1349+ . await
1350+ {
1351+ error ! ( "failed to produce and publish own sync_committee messages: {error:?}" ) ;
1352+ }
12961353 }
1297-
1298- Ok ( ( ) )
12991354 }
13001355
13011356 fn next_graffiti ( & mut self ) -> H256 {
0 commit comments