Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions prdoc/pr_11028.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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<Vec<u8>>,
}
```

`CompactProof` only contains `Vec<Vec<u8>>`, which already implements `DecodeWithMemTracking`, so the derive works without any manual implementation.
crates:
- name: sp-trie
bump: patch
validate: false
2 changes: 1 addition & 1 deletion substrate/primitives/trie/src/storage_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl<H: Hasher> From<&StorageProof> for crate::MemoryDB<H> {
}

/// 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<Vec<u8>>,
}
Expand Down
Loading