Polkadot companion #6603: Use a BoundedVec in ValidationResult (#2161)

* Convert message `Vec`s into `BoundedVec`s

* cargo fmt

* Fix missing conversions in collator

* Fix the fix

* Fix the fix to the fix

* Fix tests

* Fix^4

* Avoid use of unwrap

* update lockfile for {"substrate", "polkadot"}

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Marcin S
2023-02-16 16:50:00 +01:00
committed by GitHub
parent 5d1083f597
commit 9691acacd4
4 changed files with 294 additions and 264 deletions
+25 -2
View File
@@ -198,11 +198,34 @@ where
.ok()
.flatten()?;
let upward_messages = collation_info
.upward_messages
.try_into()
.map_err(|e| {
tracing::error!(
target: LOG_TARGET,
error = ?e,
"Number of upward messages should not be greater than `MAX_UPWARD_MESSAGE_NUM`",
)
})
.ok()?;
let horizontal_messages = collation_info
.horizontal_messages
.try_into()
.map_err(|e| {
tracing::error!(
target: LOG_TARGET,
error = ?e,
"Number of horizontal messages should not be greater than `MAX_HORIZONTAL_MESSAGE_NUM`",
)
})
.ok()?;
Some(Collation {
upward_messages: collation_info.upward_messages,
upward_messages,
new_validation_code: collation_info.new_validation_code,
processed_downward_messages: collation_info.processed_downward_messages,
horizontal_messages: collation_info.horizontal_messages,
horizontal_messages,
hrmp_watermark: collation_info.hrmp_watermark,
head_data: collation_info.head_data,
proof_of_validity: MaybeCompressedPoV::Compressed(pov),