3030//! (which requires state not owned by the request manager).
3131
3232use super :: {
33- BENEFIT_VALID_RESPONSE , BENEFIT_VALID_STATEMENT , COST_DISABLED_VALIDATOR ,
33+ seconded_and_sufficient , BENEFIT_VALID_RESPONSE , BENEFIT_VALID_STATEMENT ,
3434 COST_IMPROPERLY_DECODED_RESPONSE , COST_INVALID_RESPONSE , COST_INVALID_SIGNATURE ,
3535 COST_UNREQUESTED_RESPONSE_STATEMENT , REQUEST_RETRY_DELAY ,
3636} ;
3737use crate :: LOG_TARGET ;
3838
39- use bitvec:: prelude:: { BitVec , Lsb0 } ;
4039use polkadot_node_network_protocol:: {
4140 request_response:: {
4241 outgoing:: { Recipient as RequestRecipient , RequestError } ,
@@ -496,10 +495,6 @@ fn find_request_target_with_update(
496495 }
497496}
498497
499- fn seconded_and_sufficient ( filter : & StatementFilter , backing_threshold : Option < usize > ) -> bool {
500- backing_threshold. map_or ( true , |t| filter. has_seconded ( ) && filter. backing_validators ( ) >= t)
501- }
502-
503498/// A response to a request, which has not yet been handled.
504499pub struct UnhandledResponse {
505500 response : TaggedResponse ,
@@ -529,7 +524,6 @@ impl UnhandledResponse {
529524 /// * If the response is partially valid, misbehavior by the responding peer.
530525 /// * If there are other peers which have advertised the same candidate for different
531526 /// relay-parents or para-ids, misbehavior reports for those peers will also be generated.
532- /// * Statements from disabled validators are filtered out and reported as misbehavior.
533527 ///
534528 /// Finally, in the case that the response is either valid or partially valid,
535529 /// this will clean up all remaining requests for the candidate in the manager.
@@ -544,7 +538,6 @@ impl UnhandledResponse {
544538 session : SessionIndex ,
545539 validator_key_lookup : impl Fn ( ValidatorIndex ) -> Option < ValidatorId > ,
546540 allowed_para_lookup : impl Fn ( ParaId , GroupIndex ) -> bool ,
547- disabled_mask : BitVec < u8 , Lsb0 > ,
548541 ) -> ResponseValidationOutput {
549542 let UnhandledResponse {
550543 response : TaggedResponse { identifier, requested_peer, props, response } ,
@@ -628,7 +621,6 @@ impl UnhandledResponse {
628621 session,
629622 validator_key_lookup,
630623 allowed_para_lookup,
631- disabled_mask,
632624 ) ;
633625
634626 if let CandidateRequestStatus :: Complete { .. } = output. request_status {
@@ -648,11 +640,10 @@ fn validate_complete_response(
648640 session : SessionIndex ,
649641 validator_key_lookup : impl Fn ( ValidatorIndex ) -> Option < ValidatorId > ,
650642 allowed_para_lookup : impl Fn ( ParaId , GroupIndex ) -> bool ,
651- mut disabled_mask : BitVec < u8 , Lsb0 > ,
652643) -> ResponseValidationOutput {
653644 let RequestProperties { backing_threshold, mut unwanted_mask } = props;
654645
655- // sanity check bitmasks size. this is based entirely on
646+ // sanity check bitmask size. this is based entirely on
656647 // local logic here.
657648 if !unwanted_mask. has_len ( group. len ( ) ) {
658649 gum:: error!(
@@ -665,16 +656,6 @@ fn validate_complete_response(
665656 unwanted_mask. seconded_in_group . resize ( group. len ( ) , true ) ;
666657 unwanted_mask. validated_in_group . resize ( group. len ( ) , true ) ;
667658 }
668- if disabled_mask. len ( ) != group. len ( ) {
669- gum:: error!(
670- target: LOG_TARGET ,
671- group_len = group. len( ) ,
672- "Logic bug: group size != disabled bitmask len"
673- ) ;
674-
675- // resize and attempt to continue.
676- disabled_mask. resize ( group. len ( ) , false ) ;
677- }
678659
679660 let invalid_candidate_output = || ResponseValidationOutput {
680661 request_status : CandidateRequestStatus :: Incomplete ,
@@ -752,11 +733,6 @@ fn validate_complete_response(
752733 rep_changes. push ( ( requested_peer, COST_UNREQUESTED_RESPONSE_STATEMENT ) ) ;
753734 continue
754735 }
755-
756- if disabled_mask[ i] {
757- rep_changes. push ( ( requested_peer, COST_DISABLED_VALIDATOR ) ) ;
758- continue
759- }
760736 } ,
761737 CompactStatement :: Valid ( _) => {
762738 if unwanted_mask. validated_in_group [ i] {
@@ -768,11 +744,6 @@ fn validate_complete_response(
768744 rep_changes. push ( ( requested_peer, COST_UNREQUESTED_RESPONSE_STATEMENT ) ) ;
769745 continue
770746 }
771-
772- if disabled_mask[ i] {
773- rep_changes. push ( ( requested_peer, COST_DISABLED_VALIDATOR ) ) ;
774- continue
775- }
776747 } ,
777748 }
778749
@@ -1038,7 +1009,6 @@ mod tests {
10381009 let group = & [ ValidatorIndex ( 0 ) , ValidatorIndex ( 1 ) , ValidatorIndex ( 2 ) ] ;
10391010
10401011 let unwanted_mask = StatementFilter :: blank ( group_size) ;
1041- let disabled_mask = unwanted_mask. seconded_in_group . clone ( ) ;
10421012 let request_properties = RequestProperties { unwanted_mask, backing_threshold : None } ;
10431013
10441014 // Get requests.
@@ -1082,7 +1052,6 @@ mod tests {
10821052 0 ,
10831053 validator_key_lookup,
10841054 allowed_para_lookup,
1085- disabled_mask. clone ( ) ,
10861055 ) ;
10871056 assert_eq ! (
10881057 output,
@@ -1121,7 +1090,6 @@ mod tests {
11211090 0 ,
11221091 validator_key_lookup,
11231092 allowed_para_lookup,
1124- disabled_mask,
11251093 ) ;
11261094 assert_eq ! (
11271095 output,
@@ -1161,7 +1129,6 @@ mod tests {
11611129 let group = & [ ValidatorIndex ( 0 ) , ValidatorIndex ( 1 ) , ValidatorIndex ( 2 ) ] ;
11621130
11631131 let unwanted_mask = StatementFilter :: blank ( group_size) ;
1164- let disabled_mask = unwanted_mask. seconded_in_group . clone ( ) ;
11651132 let request_properties = RequestProperties { unwanted_mask, backing_threshold : None } ;
11661133 let peer_advertised =
11671134 |_identifier : & CandidateIdentifier , _peer : & _ | Some ( StatementFilter :: full ( group_size) ) ;
@@ -1202,7 +1169,6 @@ mod tests {
12021169 0 ,
12031170 validator_key_lookup,
12041171 allowed_para_lookup,
1205- disabled_mask,
12061172 ) ;
12071173 assert_eq ! (
12081174 output,
@@ -1243,7 +1209,6 @@ mod tests {
12431209 let group = & [ ValidatorIndex ( 0 ) , ValidatorIndex ( 1 ) , ValidatorIndex ( 2 ) ] ;
12441210
12451211 let unwanted_mask = StatementFilter :: blank ( group_size) ;
1246- let disabled_mask = unwanted_mask. seconded_in_group . clone ( ) ;
12471212 let request_properties = RequestProperties { unwanted_mask, backing_threshold : None } ;
12481213 let peer_advertised =
12491214 |_identifier : & CandidateIdentifier , _peer : & _ | Some ( StatementFilter :: full ( group_size) ) ;
@@ -1282,7 +1247,6 @@ mod tests {
12821247 0 ,
12831248 validator_key_lookup,
12841249 allowed_para_lookup,
1285- disabled_mask,
12861250 ) ;
12871251 assert_eq ! (
12881252 output,
0 commit comments