@@ -30,18 +30,28 @@ use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen};
3030use sp_arithmetic:: traits:: SaturatedConversion ;
3131use sp_std:: prelude:: * ;
3232
33+ use crate :: storage:: ProofSizeMode ;
34+
3335/// A type that allow to store a value.
3436///
3537/// Each value is stored at:
3638/// ```nocompile
3739/// Twox128(Prefix::pallet_prefix()) ++ Twox128(Prefix::STORAGE_PREFIX)
3840/// ```
39- pub struct StorageValue < Prefix , Value , QueryKind = OptionQuery , OnEmpty = GetDefault > (
40- core:: marker:: PhantomData < ( Prefix , Value , QueryKind , OnEmpty ) > ,
41+ pub struct StorageValue < Prefix , Value , QueryKind = OptionQuery , OnEmpty = GetDefault , ProofSize = MeasureProofSize > (
42+ core:: marker:: PhantomData < ( Prefix , Value , QueryKind , OnEmpty , ProofSize ) > ,
4143) ;
4244
43- impl < Prefix , Value , QueryKind , OnEmpty > crate :: storage:: generator:: StorageValue < Value >
44- for StorageValue < Prefix , Value , QueryKind , OnEmpty >
45+ pub struct MeasureProofSize ;
46+
47+ impl crate :: pallet_prelude:: Get < Option < ProofSizeMode > > for MeasureProofSize {
48+ fn get ( ) -> Option < ProofSizeMode > {
49+ None
50+ }
51+ }
52+
53+ impl < Prefix , Value , QueryKind , OnEmpty , ProofSize > crate :: storage:: generator:: StorageValue < Value >
54+ for StorageValue < Prefix , Value , QueryKind , OnEmpty , ProofSize >
4555where
4656 Prefix : StorageInstance ,
4757 Value : FullCodec ,
6373 }
6474}
6575
66- impl < Prefix , Value , QueryKind , OnEmpty > StorageValue < Prefix , Value , QueryKind , OnEmpty >
76+ impl < Prefix , Value , QueryKind , OnEmpty , ProofSize > StorageValue < Prefix , Value , QueryKind , OnEmpty , ProofSize >
6777where
6878 Prefix : StorageInstance ,
6979 Value : FullCodec ,
@@ -224,13 +234,14 @@ where
224234 }
225235}
226236
227- impl < Prefix , Value , QueryKind , OnEmpty > crate :: traits:: StorageInfoTrait
228- for StorageValue < Prefix , Value , QueryKind , OnEmpty >
237+ impl < Prefix , Value , QueryKind , OnEmpty , ProofSize > crate :: traits:: StorageInfoTrait
238+ for StorageValue < Prefix , Value , QueryKind , OnEmpty , ProofSize >
229239where
230240 Prefix : StorageInstance ,
231241 Value : FullCodec + MaxEncodedLen ,
232242 QueryKind : QueryKindTrait < Value , OnEmpty > ,
233243 OnEmpty : crate :: traits:: Get < QueryKind :: Query > + ' static ,
244+ ProofSize : crate :: traits:: Get < Option < crate :: storage:: ProofSizeMode > > ,
234245{
235246 fn storage_info ( ) -> Vec < StorageInfo > {
236247 vec ! [ StorageInfo {
@@ -239,7 +250,7 @@ where
239250 prefix: Self :: hashed_key( ) . to_vec( ) ,
240251 max_values: Some ( 1 ) ,
241252 max_size: Some ( Value :: max_encoded_len( ) . saturated_into( ) ) ,
242- proof_size: None ,
253+ proof_size: ProofSize :: get ( ) ,
243254 } ]
244255 }
245256}
0 commit comments