diff --git a/prdoc/pr_11028.prdoc b/prdoc/pr_11028.prdoc new file mode 100644 index 0000000000000..a6ddc5457149b --- /dev/null +++ b/prdoc/pr_11028.prdoc @@ -0,0 +1,30 @@ +title: Add `DecodeWithMemTracking` derive to `CompactProof` +doc: +- audience: Runtime Dev + description: |- + # Description + + Add `DecodeWithMemTracking` derive to `CompactProof` in `substrate/primitives/trie/src/storage_proof.rs`. + + `StorageProof` already derived `DecodeWithMemTracking` but `CompactProof` in the same file was missed. + + ## Integration + + No integration changes required for downstream projects. `CompactProof` now implements `DecodeWithMemTracking`, which is a strictly additive trait implementation. Existing code using `CompactProof` will continue to work as before. + + ## Review Notes + + Single-line change adding `DecodeWithMemTracking` to the derive macro list on `CompactProof`: + + ```diff + -#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] + +#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo)] + pub struct CompactProof { + pub encoded_nodes: Vec>, + } + ``` + + `CompactProof` only contains `Vec>`, which already implements `DecodeWithMemTracking`, so the derive works without any manual implementation. +crates: +- name: sp-trie + bump: patch diff --git a/substrate/primitives/trie/src/storage_proof.rs b/substrate/primitives/trie/src/storage_proof.rs index 8bb6eb1da9c50..93a8bb4289584 100644 --- a/substrate/primitives/trie/src/storage_proof.rs +++ b/substrate/primitives/trie/src/storage_proof.rs @@ -172,7 +172,7 @@ impl From<&StorageProof> for crate::MemoryDB { } /// Storage proof in compact form. -#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] +#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo)] pub struct CompactProof { pub encoded_nodes: Vec>, }