Use a BoundedVec in ValidationResult (#6603)

* Use a `BoundedVec` in `ValidationResult`

> Use a `BoundedVec` for `upward_messages` and `horizontal_messages` in order to
> limit the number of individual messages/memory allocations right at decoding
> time. The reason for this is that the `ValidationResult` may contain a code
> upgrade (including a full PVF binary), so the total size limit can't be set
> too low and this limit will still allow several millions of upward messages,
> which will (due to the memory allocator overhead) already have a
> non-negligible memory footprint in decoded form.

* List all fields when hashing so we don't miss one

* Define types for  `BoundedVec`s of messages

* Fix test compile errors

* Depend on `bounded-collections` 0.1.4 (fixes allocation issue)

* Fix compilation issue

* Derive `Hash` instead of manual `impl`

* Avoid use of unwrap
This commit is contained in:
Marcin S
2023-02-16 16:08:56 +01:00
committed by GitHub
parent 686f6972ce
commit d5a7991429
26 changed files with 124 additions and 74 deletions
+5 -2
View File
@@ -662,9 +662,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
[[package]]
name = "bounded-collections"
version = "0.1.4"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de2aff4807e40f478132150d80b031f2461d88f061851afcab537d7600c24120"
checksum = "a071c348a5ef6da1d3a87166b408170b46002382b1dda83992b5c2208cefb370"
dependencies = [
"log",
"parity-scale-codec",
@@ -7162,6 +7162,7 @@ dependencies = [
"sp-core",
"sp-keystore",
"sp-maybe-compressed-blob",
"sp-runtime",
"thiserror",
"zstd",
]
@@ -7286,6 +7287,7 @@ dependencies = [
name = "polkadot-parachain"
version = "0.9.37"
dependencies = [
"bounded-collections",
"derive_more",
"frame-support",
"parity-scale-codec",
@@ -7576,6 +7578,7 @@ dependencies = [
"pallet-timestamp",
"pallet-vesting",
"parity-scale-codec",
"polkadot-parachain",
"polkadot-primitives",
"polkadot-primitives-test-helpers",
"polkadot-runtime-metrics",