File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed
statement-distribution/src/v2 Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -637,6 +637,12 @@ pub mod v2 {
637637 }
638638 }
639639
640+ /// Returns `true` if the filter consists of zeroes.
641+ pub fn is_blank ( & self ) -> bool {
642+ self . seconded_in_group . leading_zeros ( ) == self . seconded_in_group . len ( ) &&
643+ self . validated_in_group . leading_zeros ( ) == self . validated_in_group . len ( )
644+ }
645+
640646 /// Whether the filter has a specific expected length, consistent across both
641647 /// bitfields.
642648 pub fn has_len ( & self , len : usize ) -> bool {
Original file line number Diff line number Diff line change @@ -788,6 +788,11 @@ fn validate_complete_response(
788788 return invalid_candidate_output ( )
789789 }
790790
791+ // If we filtered out all statements, the response is invalid.
792+ if received_filter. is_blank ( ) {
793+ return invalid_candidate_output ( )
794+ }
795+
791796 statements
792797 } ;
793798
Original file line number Diff line number Diff line change @@ -1242,7 +1242,7 @@ fn peer_reported_for_providing_statement_from_disabled_validator() {
12421242 assert_matches ! (
12431243 overseer. recv( ) . await ,
12441244 AllMessages :: NetworkBridgeTx ( NetworkBridgeTxMessage :: ReportPeer ( ReportPeerMessage :: Single ( p, r) ) )
1245- if p == peer_b && r == BENEFIT_VALID_RESPONSE . into( ) => { }
1245+ if p == peer_b && r == COST_INVALID_RESPONSE . into( ) => { }
12461246 ) ;
12471247
12481248 assert_matches ! (
You can’t perform that action at this time.
0 commit comments