@@ -420,7 +420,12 @@ async def on_gossip_block(
420420 )
421421 return
422422
423- logger .debug ("Processing gossip block from %s in state %s" , peer_id , self ._state .name )
423+ logger .info (
424+ "Block received from peer %s slot=%s (state=%s)" ,
425+ peer_id ,
426+ block .message .block .slot ,
427+ self ._state .name ,
428+ )
424429
425430 if self ._head_sync is None :
426431 raise RuntimeError ("HeadSync not initialized" )
@@ -440,6 +445,14 @@ async def on_gossip_block(
440445 #
441446 # A block may be cached instead of processed if its parent is unknown.
442447 if result .processed :
448+ slot = block .message .block .slot
449+ block_root = hash_tree_root (block .message .block )
450+ logger .info (
451+ "Block processed slot=%s root=%s from peer %s" ,
452+ slot ,
453+ block_root .hex (),
454+ peer_id ,
455+ )
443456 self .store = new_store
444457 self ._replay_pending_attestations ()
445458
@@ -452,6 +465,7 @@ async def on_gossip_block(
452465 async def on_gossip_attestation (
453466 self ,
454467 attestation : SignedAttestation ,
468+ peer_id : PeerId | None = None ,
455469 ) -> None :
456470 """
457471 Handle attestation received via gossip.
@@ -465,6 +479,7 @@ async def on_gossip_attestation(
465479
466480 Args:
467481 attestation: The signed attestation received.
482+ peer_id: Peer that propagated the attestation (None if produced locally).
468483 """
469484 # Guard: Only process gossip in states that accept it.
470485 #
@@ -473,6 +488,16 @@ async def on_gossip_attestation(
473488 if not self ._state .accepts_gossip :
474489 return
475490
491+ slot = attestation .data .slot
492+ validator_id = attestation .validator_id
493+ peer_str = str (peer_id ) if peer_id is not None else "local"
494+ logger .info (
495+ "Attestation received from peer %s slot=%s validator=%s" ,
496+ peer_str ,
497+ slot ,
498+ validator_id ,
499+ )
500+
476501 # Check if we are an aggregator.
477502 #
478503 # A validator acts as an aggregator when it is active (has an ID)
@@ -489,7 +514,20 @@ async def on_gossip_attestation(
489514 signed_attestation = attestation ,
490515 is_aggregator = is_aggregator_role ,
491516 )
492- except (AssertionError , KeyError ):
517+ logger .info (
518+ "Attestation from peer %s slot=%s validator=%s: validation and signature ok" ,
519+ peer_str ,
520+ slot ,
521+ validator_id ,
522+ )
523+ except (AssertionError , KeyError ) as e :
524+ logger .warning (
525+ "Attestation from peer %s slot=%s validator=%s: validation or signature failed: %s" ,
526+ peer_str ,
527+ slot ,
528+ validator_id ,
529+ e ,
530+ )
493531 # Attestation references a block not yet in our store.
494532 #
495533 # Buffer it for replay after the next block is processed.
@@ -502,6 +540,7 @@ async def on_gossip_attestation(
502540 async def on_gossip_aggregated_attestation (
503541 self ,
504542 signed_attestation : SignedAggregatedAttestation ,
543+ peer_id : PeerId | None = None ,
505544 ) -> None :
506545 """
507546 Handle aggregated attestation received via gossip.
@@ -512,13 +551,33 @@ async def on_gossip_aggregated_attestation(
512551
513552 Args:
514553 signed_attestation: The signed aggregated attestation received.
554+ peer_id: Peer that propagated the attestation (None if produced locally).
515555 """
516556 if not self ._state .accepts_gossip :
517557 return
518558
559+ slot = signed_attestation .data .slot
560+ peer_str = str (peer_id ) if peer_id is not None else "local"
561+ logger .info (
562+ "Aggregated attestation received from peer %s slot=%s" ,
563+ peer_str ,
564+ slot ,
565+ )
566+
519567 try :
520568 self .store = self .store .on_gossip_aggregated_attestation (signed_attestation )
521- except (AssertionError , KeyError ):
569+ logger .info (
570+ "Aggregated attestation from peer %s slot=%s: validation and signature ok" ,
571+ peer_str ,
572+ slot ,
573+ )
574+ except (AssertionError , KeyError ) as e :
575+ logger .warning (
576+ "Aggregated attestation from peer %s slot=%s: validation or signature failed: %s" ,
577+ peer_str ,
578+ slot ,
579+ e ,
580+ )
522581 # Target block not yet processed. Buffer for replay.
523582 self ._pending_aggregated_attestations .append (signed_attestation )
524583 if len (self ._pending_aggregated_attestations ) > MAX_PENDING_ATTESTATIONS :
0 commit comments