Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject storage proofs with unused nodes: begin #1878

Merged
merged 9 commits into from
Feb 15, 2023
Prev Previous commit
added comment
  • Loading branch information
svyatonik committed Feb 15, 2023
commit 959f6feda69f73711fc9fcee7ce95630e3abb9aa
4 changes: 3 additions & 1 deletion primitives/runtime/src/storage_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,13 @@ where
trie.get(&key)?;
}

// recorder may record the same trie node multiple times and we don't want duplicate nodes
// in our proofs => let's deduplicate it by collecting to the BTreeSet first
Ok(recorder
.drain()
.into_iter()
.map(|n| n.data.to_vec())
.collect::<BTreeSet<_>>() // deduplicate
.collect::<BTreeSet<_>>()
.into_iter()
.collect())
}
Expand Down