diff --git a/cumulus/pallets/parachain-system/src/parachain_inherent.rs b/cumulus/pallets/parachain-system/src/parachain_inherent.rs index 348f1e3a1ff5e..e00533a610840 100644 --- a/cumulus/pallets/parachain-system/src/parachain_inherent.rs +++ b/cumulus/pallets/parachain-system/src/parachain_inherent.rs @@ -194,6 +194,10 @@ impl AbridgedInboundMessagesCollection { collection_name: &str, size_info: AbridgedInboundMessagesSizeInfo, ) { + if self.hashed_messages.is_empty() { + return; + } + // We should check that the collection contains as many full messages as possible // without exceeding the max expected size. let AbridgedInboundMessagesSizeInfo { max_full_messages_size, first_hashed_msg_max_size } = @@ -536,6 +540,22 @@ mod tests { #[test] fn check_enough_messages_included_advanced_works() { + let full_messages = AbridgedInboundHrmpMessages { + full_messages: vec![( + 1000.into(), + InboundHrmpMessage { sent_at: 0, data: vec![1; 50] }, + )], + hashed_messages: vec![], + }; + // This should work if there are no hashed messages. + full_messages.check_enough_messages_included_advanced( + "Test", + AbridgedInboundMessagesSizeInfo { + max_full_messages_size: 100, + first_hashed_msg_max_size: 25, + }, + ); + let mixed_messages = AbridgedInboundHrmpMessages { full_messages: vec![( 1000.into(), diff --git a/prdoc/pr_11024.prdoc b/prdoc/pr_11024.prdoc new file mode 100644 index 0000000000000..24868669936e5 --- /dev/null +++ b/prdoc/pr_11024.prdoc @@ -0,0 +1,10 @@ +title: Fix `check_enough_messages_included_advanced()` +doc: +- audience: Todo + description: |- + Related to https://github.com/paritytech/polkadot-sdk/pull/9086 + + The check should succeed if there are no hashed messages. +crates: +- name: cumulus-pallet-parachain-system + bump: patch