Reject storage proofs with unused nodes: begin (#1878)

* reject storage proofs with unused nodes: begin

* fix ignores_parachain_head_if_it_is_missing_from_storage_proof

* message_proof_is_rejected_if_it_has_duplicate_trie_nodes && message_proof_is_rejected_if_it_has_unused_trie_nodes

* proof_with_duplicate_items_is_rejected and proof_with_unused_items_is_rejected

* clippy

* fix benchmarks compilation

* impl From<Error> for &'static str

* fix review comments

* added comment
This commit is contained in:
Svyatoslav Nikolsky
2023-02-15 18:15:05 +03:00
committed by Bastian Köcher
parent 9e30130054
commit 25c17feb23
11 changed files with 217 additions and 86 deletions
@@ -22,7 +22,7 @@
//! chains. Having pallets that are referencing polkadot, would mean that there may
//! be two versions of polkadot crates included in the runtime. Which is bad.
use bp_runtime::Size;
use bp_runtime::{RawStorageProof, Size};
use codec::{CompactAs, Decode, Encode, MaxEncodedLen};
use frame_support::RuntimeDebug;
use scale_info::TypeInfo;
@@ -88,7 +88,7 @@ pub type ParaHasher = crate::Hasher;
/// Raw storage proof of parachain heads, stored in polkadot-like chain runtime.
#[derive(Clone, Decode, Encode, Eq, PartialEq, RuntimeDebug, TypeInfo)]
pub struct ParaHeadsProof(pub Vec<Vec<u8>>);
pub struct ParaHeadsProof(pub RawStorageProof);
impl Size for ParaHeadsProof {
fn size(&self) -> u32 {