From dc13782f9d716ce251aed36ce4bb1ec91357a333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 4 Oct 2021 13:14:03 +0200 Subject: [PATCH] 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 --- polkadot/runtime/parachains/src/inclusion.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/polkadot/runtime/parachains/src/inclusion.rs b/polkadot/runtime/parachains/src/inclusion.rs index 1c37bce3bd..7150dbbfb7 100644 --- a/polkadot/runtime/parachains/src/inclusion.rs +++ b/polkadot/runtime/parachains/src/inclusion.rs @@ -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. @@ -328,8 +326,6 @@ impl Pallet { candidate_pending_availability.availability_votes.get_mut(val_idx) }) { *bit = true; - } else if cfg!(debug_assertions) { - ensure!(false, Error::::InternalError); } } @@ -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.