Skip to content

Commit 067482e

Browse files
paritytech-release-backport-bot[bot]snowmeadgithub-actions[bot]
authored
[stable2503] Backport #11028 (#11039)
Backport #11028 into `stable2503` from snowmead. See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot. <!-- # To be used by other automation, do not modify: original-pr-number: #${pull_number} --> Co-authored-by: Michael Assaf <94772640+snowmead@users.noreply.github.com> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 6ae4615 commit 067482e

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

prdoc/pr_11028.prdoc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
title: Add `DecodeWithMemTracking` derive to `CompactProof`
2+
doc:
3+
- audience: Runtime Dev
4+
description: |-
5+
# Description
6+
7+
Add `DecodeWithMemTracking` derive to `CompactProof` in `substrate/primitives/trie/src/storage_proof.rs`.
8+
9+
`StorageProof` already derived `DecodeWithMemTracking` but `CompactProof` in the same file was missed.
10+
11+
## Integration
12+
13+
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.
14+
15+
## Review Notes
16+
17+
Single-line change adding `DecodeWithMemTracking` to the derive macro list on `CompactProof`:
18+
19+
```diff
20+
-#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, TypeInfo)]
21+
+#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo)]
22+
pub struct CompactProof {
23+
pub encoded_nodes: Vec<Vec<u8>>,
24+
}
25+
```
26+
27+
`CompactProof` only contains `Vec<Vec<u8>>`, which already implements `DecodeWithMemTracking`, so the derive works without any manual implementation.
28+
crates:
29+
- name: sp-trie
30+
bump: patch

substrate/primitives/trie/src/storage_proof.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl<H: Hasher> From<&StorageProof> for crate::MemoryDB<H> {
172172
}
173173

174174
/// Storage proof in compact form.
175-
#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, TypeInfo)]
175+
#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode, DecodeWithMemTracking, TypeInfo)]
176176
pub struct CompactProof {
177177
pub encoded_nodes: Vec<Vec<u8>>,
178178
}

0 commit comments

Comments
 (0)