Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Fix unoccupied bitfields (#4004)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bkchr authored Oct 4, 2021
1 parent f951807 commit 6cb31e5
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions runtime/parachains/src/inclusion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ pub mod pallet {
NotCollatorSigned,
/// The validation data hash does not match expected.
ValidationDataHashMismatch,
/// Internal error only returned when compiled with debug assertions.
InternalError,
/// The downward message queue is not processed correctly.
IncorrectDownwardMessageHandling,
/// At least one upward message sent does not pass the acceptance criteria.
Expand Down Expand Up @@ -328,8 +326,6 @@ impl<T: Config> Pallet<T> {
candidate_pending_availability.availability_votes.get_mut(val_idx)
}) {
*bit = true;
} else if cfg!(debug_assertions) {
ensure!(false, Error::<T>::InternalError);
}
}

Expand Down Expand Up @@ -1412,13 +1408,14 @@ mod tests {
bare_bitfield,
&signing_context,
));

assert!(ParaInclusion::process_bitfields(
expected_bits(),
vec![signed.into()],
&core_lookup,
)
.is_err());
assert_eq!(
ParaInclusion::process_bitfields(
expected_bits(),
vec![signed.into()],
&core_lookup,
),
Ok(vec![])
);
}

// empty bitfield signed: always OK, but kind of useless.
Expand Down

0 comments on commit 6cb31e5

Please sign in to comment.