@@ -676,7 +676,6 @@ impl<I: PartialEq + std::fmt::Display, T> ByRangeRequest<I, T> {
676676#[ cfg( test) ]
677677mod tests {
678678 use super :: RangeBlockComponentsRequest ;
679- use crate :: sync:: network_context:: MAX_COLUMN_RETRIES ;
680679 use beacon_chain:: test_utils:: {
681680 NumBlobs , generate_rand_block_and_blobs, generate_rand_block_and_data_columns, test_spec,
682681 } ;
@@ -1100,93 +1099,4 @@ mod tests {
11001099 let rpc_blocks = result. unwrap ( ) ;
11011100 assert_eq ! ( rpc_blocks. len( ) , 2 ) ;
11021101 }
1103-
1104- #[ test]
1105- fn max_retries_exceeded_behavior ( ) {
1106- // GIVEN: A request where peers consistently fail to provide required columns
1107- let spec = test_spec :: < E > ( ) ;
1108- let expected_custody_columns = vec ! [ 1 , 2 ] ;
1109- let mut rng = XorShiftRng :: from_seed ( [ 42 ; 16 ] ) ;
1110- let blocks = ( 0 ..1 )
1111- . map ( |_| {
1112- generate_rand_block_and_data_columns :: < E > (
1113- ForkName :: Fulu ,
1114- NumBlobs :: Number ( 1 ) ,
1115- & mut rng,
1116- & spec,
1117- )
1118- } )
1119- . collect :: < Vec < _ > > ( ) ;
1120-
1121- let components_id = components_id ( ) ;
1122- let blocks_req_id = blocks_id ( components_id) ;
1123- let columns_req_id = expected_custody_columns
1124- . iter ( )
1125- . enumerate ( )
1126- . map ( |( i, column) | ( columns_id ( i as Id , components_id) , vec ! [ * column] ) )
1127- . collect :: < Vec < _ > > ( ) ;
1128- let mut info = RangeBlockComponentsRequest :: < E > :: new (
1129- blocks_req_id,
1130- None ,
1131- Some ( ( columns_req_id. clone ( ) , expected_custody_columns. clone ( ) ) ) ,
1132- None ,
1133- Span :: none ( ) ,
1134- ) ;
1135-
1136- // AND: All blocks are received
1137- info. add_blocks (
1138- blocks_req_id,
1139- blocks. iter ( ) . map ( |b| b. 0 . clone ( ) . into ( ) ) . collect ( ) ,
1140- )
1141- . unwrap ( ) ;
1142-
1143- // AND: Only partial custody columns are provided (column 1 but not 2)
1144- let ( req1, _) = columns_req_id. first ( ) . unwrap ( ) ;
1145- info. add_custody_columns (
1146- * req1,
1147- blocks
1148- . iter ( )
1149- . flat_map ( |b| b. 1 . iter ( ) . filter ( |d| d. index == 1 ) . cloned ( ) )
1150- . collect ( ) ,
1151- )
1152- . unwrap ( ) ;
1153-
1154- // AND: Column 2 request completes with empty data (persistent peer failure)
1155- let ( req2, _) = columns_req_id. get ( 1 ) . unwrap ( ) ;
1156- info. add_custody_columns ( * req2, vec ! [ ] ) . unwrap ( ) ;
1157-
1158- // WHEN: Multiple retry attempts are made (up to max retries)
1159- for _ in 0 ..MAX_COLUMN_RETRIES {
1160- let result = info. responses ( & spec) . unwrap ( ) ;
1161- assert ! ( result. is_err( ) ) ;
1162-
1163- if let Err ( super :: CouplingError :: DataColumnPeerFailure {
1164- exceeded_retries, ..
1165- } ) = & result
1166- && * exceeded_retries
1167- {
1168- break ;
1169- }
1170- }
1171-
1172- // AND: One final attempt after exceeding max retries
1173- let result = info. responses ( & spec) . unwrap ( ) ;
1174-
1175- // THEN: Should fail with exceeded_retries = true
1176- assert ! ( result. is_err( ) ) ;
1177- if let Err ( super :: CouplingError :: DataColumnPeerFailure {
1178- error : _,
1179- faulty_peers,
1180- action,
1181- exceeded_retries,
1182- } ) = result
1183- {
1184- assert_eq ! ( faulty_peers. len( ) , 1 ) ; // column 2 missing
1185- assert_eq ! ( faulty_peers[ 0 ] . 0 , 2 ) ; // column index 2
1186- assert ! ( matches!( action, PeerAction :: LowToleranceError ) ) ;
1187- assert ! ( exceeded_retries) ; // Should be true after max retries
1188- } else {
1189- panic ! ( "Expected PeerFailure error with exceeded_retries=true" ) ;
1190- }
1191- }
11921102}
0 commit comments