@@ -428,7 +428,7 @@ fn kick_algorithm_manta() {
428428 BlocksPerCollatorThisSession :: < Test > :: insert ( 4u64 , 9 ) ;
429429 BlocksPerCollatorThisSession :: < Test > :: insert ( 5u64 , 0 ) ;
430430 assert_eq ! (
431- CollatorSelection :: kick_stale_candidates( CollatorSelection :: candidates( ) ) . unwrap ( ) ,
431+ CollatorSelection :: kick_stale_candidates( CollatorSelection :: candidates( ) ) ,
432432 vec![ 5 , 3 ]
433433 ) ;
434434
@@ -443,11 +443,12 @@ fn kick_algorithm_manta() {
443443 BlocksPerCollatorThisSession :: < Test > :: insert ( 4u64 , 9 ) ;
444444 BlocksPerCollatorThisSession :: < Test > :: insert ( 5u64 , 0 ) ;
445445 assert_eq ! (
446- CollatorSelection :: kick_stale_candidates( CollatorSelection :: candidates( ) ) . unwrap ( ) ,
446+ CollatorSelection :: kick_stale_candidates( CollatorSelection :: candidates( ) ) ,
447447 vec![ 5 , 3 ]
448448 ) ;
449449
450450 // Test boundary conditions
451+ let empty_vec = Vec :: < <Test as frame_system:: Config >:: AccountId > :: new ( ) ;
451452 // Kick anyone not at perfect performance
452453 EvictionPercentile :: < Test > :: put ( Percent :: from_percent ( 100 ) ) ;
453454 EvictionThreshold :: < Test > :: put ( Percent :: from_percent ( 0 ) ) ;
@@ -456,21 +457,21 @@ fn kick_algorithm_manta() {
456457 BlocksPerCollatorThisSession :: < Test > :: insert ( 4u64 , 10 ) ;
457458 assert_eq ! (
458459 CollatorSelection :: kick_stale_candidates( CollatorSelection :: candidates( ) ) ,
459- Some ( vec![ 3 ] )
460+ vec![ 3 ]
460461 ) ;
461462 assert_ok ! ( CollatorSelection :: register_as_candidate( Origin :: signed( 3 ) ) ) ;
462463 // Allow any underperformance => eviction disabled
463464 EvictionThreshold :: < Test > :: put ( Percent :: from_percent ( 100 ) ) ;
464465 assert_eq ! (
465466 CollatorSelection :: kick_stale_candidates( CollatorSelection :: candidates( ) ) ,
466- None
467+ empty_vec
467468 ) ;
468469 // 0-th percentile = use worst collator as benchmark => eviction disabled
469470 EvictionPercentile :: < Test > :: put ( Percent :: from_percent ( 0 ) ) ;
470471 EvictionThreshold :: < Test > :: put ( Percent :: from_percent ( 0 ) ) ;
471472 assert_eq ! (
472473 CollatorSelection :: kick_stale_candidates( CollatorSelection :: candidates( ) ) ,
473- None
474+ empty_vec
474475 ) ;
475476 // Same performance => no kick
476477 EvictionPercentile :: < Test > :: put ( Percent :: from_percent ( 100 ) ) ;
@@ -479,7 +480,7 @@ fn kick_algorithm_manta() {
479480 BlocksPerCollatorThisSession :: < Test > :: insert ( 4u64 , 10 ) ;
480481 assert_eq ! (
481482 CollatorSelection :: kick_stale_candidates( CollatorSelection :: candidates( ) ) ,
482- None
483+ empty_vec
483484 ) ;
484485 // Exactly on threshold => no kick
485486 EvictionPercentile :: < Test > :: put ( Percent :: from_percent ( 100 ) ) ;
@@ -488,7 +489,7 @@ fn kick_algorithm_manta() {
488489 BlocksPerCollatorThisSession :: < Test > :: insert ( 4u64 , 9 ) ;
489490 assert_eq ! (
490491 CollatorSelection :: kick_stale_candidates( CollatorSelection :: candidates( ) ) ,
491- None
492+ empty_vec
492493 ) ;
493494 // Rational threshold = 8.1, kick 8 and below
494495 EvictionPercentile :: < Test > :: put ( Percent :: from_percent ( 100 ) ) ;
@@ -497,7 +498,7 @@ fn kick_algorithm_manta() {
497498 BlocksPerCollatorThisSession :: < Test > :: insert ( 4u64 , 10 ) ;
498499 assert_eq ! (
499500 CollatorSelection :: kick_stale_candidates( CollatorSelection :: candidates( ) ) ,
500- Some ( vec![ 3 ] )
501+ vec![ 3 ]
501502 ) ;
502503 } ) ;
503504}
0 commit comments