From fe5caf94c4c0647fad552c07e46f99022117f681 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 22 Dec 2022 00:52:51 +0100 Subject: [PATCH] proof_size: None Signed-off-by: Oliver Tale-Yazdi --- frame/support/procedural/src/storage/storage_struct.rs | 1 + frame/support/src/storage/types/double_map.rs | 2 ++ frame/support/src/storage/types/map.rs | 2 ++ frame/support/src/storage/types/nmap.rs | 2 ++ frame/support/src/storage/types/value.rs | 2 ++ frame/support/src/traits/storage.rs | 7 +++++++ 6 files changed, 16 insertions(+) diff --git a/frame/support/procedural/src/storage/storage_struct.rs b/frame/support/procedural/src/storage/storage_struct.rs index 649a41bab5ece..d9f18c1f76cfd 100644 --- a/frame/support/procedural/src/storage/storage_struct.rs +++ b/frame/support/procedural/src/storage/storage_struct.rs @@ -281,6 +281,7 @@ pub fn decl_and_impl(def: &DeclStorageDefExt) -> TokenStream { >::storage_value_final_key().to_vec(), max_values: Some(1), max_size: Some(max_size), + proof_size, } ] } diff --git a/frame/support/src/storage/types/double_map.rs b/frame/support/src/storage/types/double_map.rs index 9ba4cf052e82a..15eb69bf78f14 100644 --- a/frame/support/src/storage/types/double_map.rs +++ b/frame/support/src/storage/types/double_map.rs @@ -701,6 +701,7 @@ where .saturating_add(Value::max_encoded_len()) .saturated_into(), ), + proof_size: None, }] } } @@ -727,6 +728,7 @@ where prefix: Self::final_prefix().to_vec(), max_values: MaxValues::get(), max_size: None, + proof_size: None, }] } } diff --git a/frame/support/src/storage/types/map.rs b/frame/support/src/storage/types/map.rs index 0f89e2378a55d..b0b86970dad65 100644 --- a/frame/support/src/storage/types/map.rs +++ b/frame/support/src/storage/types/map.rs @@ -450,6 +450,7 @@ where .saturating_add(Value::max_encoded_len()) .saturated_into(), ), + proof_size: None, }] } } @@ -474,6 +475,7 @@ where prefix: Self::final_prefix().to_vec(), max_values: MaxValues::get(), max_size: None, + proof_size: None, }] } } diff --git a/frame/support/src/storage/types/nmap.rs b/frame/support/src/storage/types/nmap.rs index dcbdac761fe15..c8ba267420e86 100755 --- a/frame/support/src/storage/types/nmap.rs +++ b/frame/support/src/storage/types/nmap.rs @@ -590,6 +590,7 @@ where .saturating_add(Value::max_encoded_len()) .saturated_into(), ), + proof_size: None, }] } } @@ -612,6 +613,7 @@ where prefix: Self::final_prefix().to_vec(), max_values: MaxValues::get(), max_size: None, + proof_size: None, }] } } diff --git a/frame/support/src/storage/types/value.rs b/frame/support/src/storage/types/value.rs index f145e9fb30414..dc3cc51b87ff1 100644 --- a/frame/support/src/storage/types/value.rs +++ b/frame/support/src/storage/types/value.rs @@ -239,6 +239,7 @@ where prefix: Self::hashed_key().to_vec(), max_values: Some(1), max_size: Some(Value::max_encoded_len().saturated_into()), + proof_size: None, }] } } @@ -259,6 +260,7 @@ where prefix: Self::hashed_key().to_vec(), max_values: Some(1), max_size: None, + proof_size: None, }] } } diff --git a/frame/support/src/traits/storage.rs b/frame/support/src/traits/storage.rs index 24653d1899836..cb1f81d687a57 100644 --- a/frame/support/src/traits/storage.rs +++ b/frame/support/src/traits/storage.rs @@ -65,6 +65,13 @@ pub struct StorageInfo { pub max_values: Option, /// The maximum size of key/values in the storage, or none if no maximum specified. pub max_size: Option, + pub proof_size: Option, +} + +#[derive(codec::Encode, codec::Decode, crate::RuntimeDebug, Eq, PartialEq, Clone)] +pub enum ProofSizeMode { + MaxEncodedLen, + Measured, } /// A trait to give information about storage.