Fix unoccupied bitfields (#4004)

* Fix unoccupied bitfields

If there is an unoccupied bitfield set, we should just ignore it and not
keep it for the rest of the logic in `process_bitfields`.

* Bring back test, but this time corrected

* Remove incorrect code
This commit is contained in:
Bastian Köcher
2021-10-04 13:14:03 +02:00
committed by GitHub
parent cd4beed7d8
commit dc13782f9d
+8 -11
View File
@@ -180,8 +180,6 @@ pub mod pallet {
NotCollatorSigned, NotCollatorSigned,
/// The validation data hash does not match expected. /// The validation data hash does not match expected.
ValidationDataHashMismatch, ValidationDataHashMismatch,
/// Internal error only returned when compiled with debug assertions.
InternalError,
/// The downward message queue is not processed correctly. /// The downward message queue is not processed correctly.
IncorrectDownwardMessageHandling, IncorrectDownwardMessageHandling,
/// At least one upward message sent does not pass the acceptance criteria. /// At least one upward message sent does not pass the acceptance criteria.
@@ -328,8 +326,6 @@ impl<T: Config> Pallet<T> {
candidate_pending_availability.availability_votes.get_mut(val_idx) candidate_pending_availability.availability_votes.get_mut(val_idx)
}) { }) {
*bit = true; *bit = true;
} else if cfg!(debug_assertions) {
ensure!(false, Error::<T>::InternalError);
} }
} }
@@ -1412,13 +1408,14 @@ mod tests {
bare_bitfield, bare_bitfield,
&signing_context, &signing_context,
)); ));
assert_eq!(
assert!(ParaInclusion::process_bitfields( ParaInclusion::process_bitfields(
expected_bits(), expected_bits(),
vec![signed.into()], vec![signed.into()],
&core_lookup, &core_lookup,
) ),
.is_err()); Ok(vec![])
);
} }
// empty bitfield signed: always OK, but kind of useless. // empty bitfield signed: always OK, but kind of useless.