@@ -28,7 +28,6 @@ use rand::thread_rng;
28
28
use requests:: ActiveDataColumnsByRootRequest ;
29
29
pub use requests:: LookupVerifyError ;
30
30
use slog:: { debug, error, warn} ;
31
- use slot_clock:: SlotClock ;
32
31
use std:: collections:: hash_map:: Entry ;
33
32
use std:: collections:: HashMap ;
34
33
use std:: sync:: Arc ;
@@ -146,8 +145,9 @@ pub enum LookupRequestResult<I = ReqId> {
146
145
/// A request is sent. Sync MUST receive an event from the network in the future for either:
147
146
/// completed response or failed request
148
147
RequestSent ( I ) ,
149
- /// No request is sent, and no further action is necessary to consider this request completed
150
- NoRequestNeeded ,
148
+ /// No request is sent, and no further action is necessary to consider this request completed.
149
+ /// Includes a reason why this request is not needed.
150
+ NoRequestNeeded ( & ' static str ) ,
151
151
/// No request is sent, but the request is not completed. Sync MUST receive some future event
152
152
/// that makes progress on the request. For example: request is processing from a different
153
153
/// source (i.e. block received from gossip) and sync MUST receive an event with that processing
@@ -544,7 +544,9 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
544
544
// Block is fully validated. If it's not yet imported it's waiting for missing block
545
545
// components. Consider this request completed and do nothing.
546
546
BlockProcessStatus :: ExecutionValidated { .. } => {
547
- return Ok ( LookupRequestResult :: NoRequestNeeded )
547
+ return Ok ( LookupRequestResult :: NoRequestNeeded (
548
+ "block execution validated" ,
549
+ ) )
548
550
}
549
551
}
550
552
@@ -595,21 +597,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
595
597
block_root : Hash256 ,
596
598
downloaded_block : Option < Arc < SignedBeaconBlock < T :: EthSpec > > > ,
597
599
) -> Result < LookupRequestResult , RpcRequestSendError > {
598
- // Check if we are into deneb, and before peerdas
599
- if !self
600
- . chain
601
- . data_availability_checker
602
- . blobs_required_for_epoch (
603
- // TODO(das): use the block's slot
604
- self . chain
605
- . slot_clock
606
- . now_or_genesis ( )
607
- . ok_or ( RpcRequestSendError :: SlotClockError ) ?
608
- . epoch ( T :: EthSpec :: slots_per_epoch ( ) ) ,
609
- )
610
- {
611
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
612
- }
613
600
let Some ( block) = downloaded_block. or_else ( || {
614
601
// If the block is already being processed or fully validated, retrieve how many blobs
615
602
// it expects. Consider any stage of the block. If the block root has been validated, we
@@ -639,7 +626,12 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
639
626
640
627
// Check if we are into peerdas
641
628
if !self . chain . should_fetch_blobs ( block_epoch) {
642
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
629
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "blobs not required" ) ) ;
630
+ }
631
+
632
+ // No data required for this block
633
+ if expected_blobs == 0 {
634
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "no data" ) ) ;
643
635
}
644
636
645
637
let imported_blob_indexes = self
@@ -654,7 +646,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
654
646
655
647
if indices. is_empty ( ) {
656
648
// No blobs required, do not issue any request
657
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
649
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "no indices to fetch" ) ) ;
658
650
}
659
651
660
652
let req_id = self . next_id ( ) ;
@@ -752,12 +744,12 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
752
744
753
745
// Check if we are into peerdas
754
746
if !self . chain . should_fetch_custody_columns ( block_epoch) {
755
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
747
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "columns not required" ) ) ;
756
748
}
757
749
758
750
// No data required for this block
759
751
if expected_blobs == 0 {
760
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
752
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "no data" ) ) ;
761
753
}
762
754
763
755
let custody_indexes_imported = self
@@ -777,7 +769,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
777
769
778
770
if custody_indexes_to_fetch. is_empty ( ) {
779
771
// No indexes required, do not issue any request
780
- return Ok ( LookupRequestResult :: NoRequestNeeded ) ;
772
+ return Ok ( LookupRequestResult :: NoRequestNeeded ( "no indices to fetch" ) ) ;
781
773
}
782
774
783
775
let req_id = self . next_id ( ) ;
0 commit comments