@@ -884,11 +884,14 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
884
884
) ;
885
885
886
886
let request_start_slot = Slot :: from ( req. start_slot ) ;
887
+ // This variable may only change when the request_start_slot + req.count spans across the Fulu fork slot
888
+ let mut effective_count = req. count ;
887
889
888
- // Check if the request slot is after a Fulu slot; if so, return empty response
889
890
if let Some ( fulu_epoch) = self . chain . spec . fulu_fork_epoch {
890
891
let fulu_start_slot = fulu_epoch. start_slot ( T :: EthSpec :: slots_per_epoch ( ) ) ;
892
+ let request_end_slot = request_start_slot + req. count - 1 ;
891
893
894
+ // If the request_start_slot is at or after a Fulu slot, return empty response
892
895
if request_start_slot >= fulu_start_slot {
893
896
debug ! (
894
897
%peer_id,
@@ -898,6 +901,17 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
898
901
"BlobsByRange request is at or after a Fulu slot, returning empty response"
899
902
) ;
900
903
return Ok ( ( ) ) ;
904
+ // For the case that the request slots spans across the Fulu fork slot
905
+ } else if request_start_slot < fulu_start_slot && request_end_slot >= fulu_start_slot {
906
+ effective_count = ( fulu_start_slot - request_start_slot) . as_u64 ( ) ;
907
+ debug ! (
908
+ %peer_id,
909
+ %request_start_slot,
910
+ %fulu_start_slot,
911
+ requested_count = req. count,
912
+ served_count = effective_count,
913
+ "BlobsByRange request spans across Fulu fork, only serving blobs before Fulu slots"
914
+ )
901
915
}
902
916
}
903
917
@@ -937,7 +951,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
937
951
}
938
952
939
953
let block_roots =
940
- self . get_block_roots_for_slot_range ( req. start_slot , req . count , "BlobsByRange" ) ?;
954
+ self . get_block_roots_for_slot_range ( req. start_slot , effective_count , "BlobsByRange" ) ?;
941
955
942
956
let current_slot = self
943
957
. chain
@@ -964,7 +978,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
964
978
// Due to skip slots, blobs could be out of the range, we ensure they
965
979
// are in the range before sending
966
980
if blob_sidecar. slot ( ) >= request_start_slot
967
- && blob_sidecar. slot ( ) < request_start_slot + req . count
981
+ && blob_sidecar. slot ( ) < request_start_slot + effective_count
968
982
{
969
983
blobs_sent += 1 ;
970
984
self . send_network_message ( NetworkMessage :: SendResponse {
0 commit comments