@@ -146,8 +146,9 @@ pub enum LookupRequestResult<I = ReqId> {
146
146
/// A request is sent. Sync MUST receive an event from the network in the future for either:
147
147
/// completed response or failed request
148
148
RequestSent ( I ) ,
149
- /// No request is sent, and no further action is necessary to consider this request completed
150
- NoRequestNeeded ,
149
+ /// No request is sent, and no further action is necessary to consider this request completed.
150
+ /// Includes a reason why this request is not needed.
151
+ NoRequestNeeded ( & ' static str ) ,
151
152
/// No request is sent, but the request is not completed. Sync MUST receive some future event
152
153
/// that makes progress on the request. For example: request is processing from a different
153
154
/// source (i.e. block received from gossip) and sync MUST receive an event with that processing
@@ -544,7 +545,9 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
544
545
// Block is fully validated. If it's not yet imported it's waiting for missing block
545
546
// components. Consider this request completed and do nothing.
546
547
BlockProcessStatus :: ExecutionValidated { .. } => {
547
- return Ok ( LookupRequestResult :: NoRequestNeeded )
548
+ return Ok ( LookupRequestResult :: NoRequestNeeded (
549
+ "block execution validated" ,
550
+ ) )
548
551
}
549
552
}
550
553
@@ -608,7 +611,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
608
611
. epoch ( T :: EthSpec :: slots_per_epoch ( ) ) ,
609
612
)
610
613
{
611
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
614
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "outside da window" ) ) ;
612
615
}
613
616
let Some ( block) = downloaded_block. or_else ( || {
614
617
// If the block is already being processed or fully validated, retrieve how many blobs
@@ -639,7 +642,12 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
639
642
640
643
// Check if we are into peerdas
641
644
if !self . chain . should_fetch_blobs ( block_epoch) {
642
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
645
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "blobs not required" ) ) ;
646
+ }
647
+
648
+ // No data required for this block
649
+ if expected_blobs == 0 {
650
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "no data" ) ) ;
643
651
}
644
652
645
653
let imported_blob_indexes = self
@@ -654,7 +662,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
654
662
655
663
if indices. is_empty ( ) {
656
664
// No blobs required, do not issue any request
657
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
665
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "no indices to fetch" ) ) ;
658
666
}
659
667
660
668
let req_id = self . next_id ( ) ;
@@ -752,12 +760,12 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
752
760
753
761
// Check if we are into peerdas
754
762
if !self . chain . should_fetch_custody_columns ( block_epoch) {
755
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
763
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "columns not required" ) ) ;
756
764
}
757
765
758
766
// No data required for this block
759
767
if expected_blobs == 0 {
760
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
768
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "no data" ) ) ;
761
769
}
762
770
763
771
let custody_indexes_imported = self
@@ -777,7 +785,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
777
785
778
786
if custody_indexes_to_fetch. is_empty ( ) {
779
787
// No indexes required, do not issue any request
780
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
788
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "no indices to fetch" ) ) ;
781
789
}
782
790
783
791
let req_id = self . next_id ( ) ;
0 commit comments