@@ -200,16 +200,26 @@ pub mod pallet {
200200 BadDataSize ,
201201 /// Too many transactions in the block.
202202 TooManyTransactions ,
203- /// Renewed extrinsic not found.
203+ /// Invalid configuration.
204+ NotConfigured ,
205+ /// Renewed extrinsic is not found.
204206 RenewedNotFound ,
207+ /// Attempting to store an empty transaction
208+ EmptyTransaction ,
205209 /// Proof was not expected in this block.
206210 UnexpectedProof ,
207211 /// Proof failed verification.
208212 InvalidProof ,
209- /// Unable to verify proof becasue state data is missing.
213+ /// Missing storage proof.
214+ MissingProof ,
215+ /// Unable to verify proof because state data is missing.
210216 MissingStateData ,
211217 /// Double proof check in the block.
212218 DoubleCheck ,
219+ /// Storage proof was not checked in the block.
220+ ProofNotChecked ,
221+ /// Transaction is too large.
222+ TransactionTooLarge ,
213223 /// Authorization was not found.
214224 AuthorizationNotFound ,
215225 /// Authorization has not expired.
@@ -329,7 +339,7 @@ pub mod pallet {
329339 } )
330340 . map_err ( |_| Error :: < T > :: TooManyTransactions )
331341 } ) ?;
332- Self :: deposit_event ( Event :: Stored { index, hash : content_hash } ) ;
342+ Self :: deposit_event ( Event :: Stored { index, content_hash } ) ;
333343 Ok ( ( ) )
334344 }
335345
@@ -378,7 +388,7 @@ pub mod pallet {
378388 } )
379389 . map_err ( |_| Error :: < T > :: TooManyTransactions )
380390 } ) ?;
381- Self :: deposit_event ( Event :: Renewed { index, hash : content_hash } ) ;
391+ Self :: deposit_event ( Event :: Renewed { index, content_hash } ) ;
382392 Ok ( ( ) . into ( ) )
383393 }
384394
@@ -452,7 +462,7 @@ pub mod pallet {
452462 ///
453463 /// Parameters:
454464 ///
455- /// - `hash `: The BLAKE2b hash of the data to be submitted.
465+ /// - `content_hash `: The BLAKE2b hash of the data to be submitted.
456466 /// - `max_size`: The maximum size, in bytes, of the preimage.
457467 ///
458468 /// The origin for this call must be the pallet's `Authorizer`. Emits
@@ -461,12 +471,12 @@ pub mod pallet {
461471 #[ pallet:: weight( T :: WeightInfo :: authorize_preimage( ) ) ]
462472 pub fn authorize_preimage (
463473 origin : OriginFor < T > ,
464- hash : ContentHash ,
474+ content_hash : ContentHash ,
465475 max_size : u64 ,
466476 ) -> DispatchResult {
467477 T :: Authorizer :: ensure_origin ( origin) ?;
468- Self :: authorize ( AuthorizationScope :: Preimage ( hash ) , 1 , max_size) ;
469- Self :: deposit_event ( Event :: PreimageAuthorized { hash , max_size } ) ;
478+ Self :: authorize ( AuthorizationScope :: Preimage ( content_hash ) , 1 , max_size) ;
479+ Self :: deposit_event ( Event :: PreimageAuthorized { content_hash , max_size } ) ;
470480 Ok ( ( ) )
471481 }
472482
@@ -493,7 +503,7 @@ pub mod pallet {
493503 ///
494504 /// Parameters:
495505 ///
496- /// - `hash `: The BLAKE2b hash that was authorized.
506+ /// - `content_hash `: The BLAKE2b hash that was authorized.
497507 ///
498508 /// Emits
499509 /// [`ExpiredPreimageAuthorizationRemoved`](Event::ExpiredPreimageAuthorizationRemoved)
@@ -502,10 +512,10 @@ pub mod pallet {
502512 #[ pallet:: weight( T :: WeightInfo :: remove_expired_preimage_authorization( ) ) ]
503513 pub fn remove_expired_preimage_authorization (
504514 _origin : OriginFor < T > ,
505- hash : ContentHash ,
515+ content_hash : ContentHash ,
506516 ) -> DispatchResult {
507- Self :: remove_expired_authorization ( AuthorizationScope :: Preimage ( hash ) ) ?;
508- Self :: deposit_event ( Event :: ExpiredPreimageAuthorizationRemoved { hash } ) ;
517+ Self :: remove_expired_authorization ( AuthorizationScope :: Preimage ( content_hash ) ) ?;
518+ Self :: deposit_event ( Event :: ExpiredPreimageAuthorizationRemoved { content_hash } ) ;
509519 Ok ( ( ) )
510520 }
511521
@@ -537,7 +547,7 @@ pub mod pallet {
537547 ///
538548 /// Parameters:
539549 ///
540- /// - `hash `: The BLAKE2b hash of the data to be submitted.
550+ /// - `content_hash `: The BLAKE2b hash of the data to be submitted.
541551 ///
542552 /// The origin for this call must be the pallet's `Authorizer`. Emits
543553 /// [`PreimageAuthorizationRefreshed`](Event::PreimageAuthorizationRefreshed) when
@@ -546,11 +556,11 @@ pub mod pallet {
546556 #[ pallet:: weight( T :: WeightInfo :: refresh_preimage_authorization( ) ) ]
547557 pub fn refresh_preimage_authorization (
548558 origin : OriginFor < T > ,
549- hash : ContentHash ,
559+ content_hash : ContentHash ,
550560 ) -> DispatchResult {
551561 T :: Authorizer :: ensure_origin ( origin) ?;
552- Self :: refresh_authorization ( AuthorizationScope :: Preimage ( hash ) ) ?;
553- Self :: deposit_event ( Event :: PreimageAuthorizationRefreshed { hash } ) ;
562+ Self :: refresh_authorization ( AuthorizationScope :: Preimage ( content_hash ) ) ?;
563+ Self :: deposit_event ( Event :: PreimageAuthorizationRefreshed { content_hash } ) ;
554564 Ok ( ( ) )
555565 }
556566 }
@@ -559,24 +569,24 @@ pub mod pallet {
559569 #[ pallet:: generate_deposit( pub ( super ) fn deposit_event) ]
560570 pub enum Event < T : Config > {
561571 /// Stored data under specified index.
562- Stored { index : u32 , hash : ContentHash } ,
572+ Stored { index : u32 , content_hash : ContentHash } ,
563573 /// Renewed data under specified index.
564- Renewed { index : u32 , hash : ContentHash } ,
574+ Renewed { index : u32 , content_hash : ContentHash } ,
565575 /// Storage proof was successfully checked.
566576 ProofChecked ,
567577 /// An account `who` was authorized to store `bytes` bytes in `transactions` transactions.
568578 AccountAuthorized { who : T :: AccountId , transactions : u32 , bytes : u64 } ,
569579 /// An authorization for account `who` was refreshed.
570580 AccountAuthorizationRefreshed { who : T :: AccountId } ,
571- /// Authorization was given for a preimage of `hash ` (not exceeding `max_size`) to be
572- /// stored by anyone.
573- PreimageAuthorized { hash : ContentHash , max_size : u64 } ,
574- /// An authorization for a preimage of `hash ` was refreshed.
575- PreimageAuthorizationRefreshed { hash : ContentHash } ,
581+ /// Authorization was given for a preimage of `content_hash ` (not exceeding `max_size`) to
582+ /// be stored by anyone.
583+ PreimageAuthorized { content_hash : ContentHash , max_size : u64 } ,
584+ /// An authorization for a preimage of `content_hash ` was refreshed.
585+ PreimageAuthorizationRefreshed { content_hash : ContentHash } ,
576586 /// An expired account authorization was removed.
577587 ExpiredAccountAuthorizationRemoved { who : T :: AccountId } ,
578588 /// An expired preimage authorization was removed.
579- ExpiredPreimageAuthorizationRemoved { hash : ContentHash } ,
589+ ExpiredPreimageAuthorizationRemoved { content_hash : ContentHash } ,
580590 }
581591
582592 /// Authorizations, keyed by scope.
@@ -743,7 +753,7 @@ pub mod pallet {
743753 // In the case of a regular unsigned transaction, pre_dispatch should have checked that
744754 // the authorization exists and has expired
745755 let Some ( authorization) = Authorizations :: < T > :: take ( & scope) else {
746- return Err ( Error :: < T > :: AuthorizationNotFound . into ( ) )
756+ return Err ( Error :: < T > :: AuthorizationNotFound . into ( ) ) ;
747757 } ;
748758 ensure ! ( Self :: expired( authorization. expiration) , Error :: <T >:: AuthorizationNotExpired ) ;
749759 Self :: authorization_removed ( & scope) ;
@@ -752,7 +762,7 @@ pub mod pallet {
752762
753763 fn authorization_extent ( scope : AuthorizationScopeFor < T > ) -> AuthorizationExtent {
754764 let Some ( authorization) = Authorizations :: < T > :: get ( & scope) else {
755- return AuthorizationExtent { transactions : 0 , bytes : 0 }
765+ return AuthorizationExtent { transactions : 0 , bytes : 0 } ;
756766 } ;
757767 if Self :: expired ( authorization. expiration ) {
758768 AuthorizationExtent { transactions : 0 , bytes : 0 }
@@ -870,7 +880,7 @@ pub mod pallet {
870880 scope : AuthorizationScopeFor < T > ,
871881 ) -> Result < ( ) , TransactionValidityError > {
872882 let Some ( authorization) = Authorizations :: < T > :: get ( & scope) else {
873- return Err ( AUTHORIZATION_NOT_FOUND . into ( ) )
883+ return Err ( AUTHORIZATION_NOT_FOUND . into ( ) ) ;
874884 } ;
875885 if Self :: expired ( authorization. expiration ) {
876886 Ok ( ( ) )
@@ -885,11 +895,11 @@ pub mod pallet {
885895 context : CheckContext ,
886896 ) -> Result < Option < ValidTransaction > , TransactionValidityError > {
887897 if !Self :: data_size_ok ( size) {
888- return Err ( BAD_DATA_SIZE . into ( ) )
898+ return Err ( BAD_DATA_SIZE . into ( ) ) ;
889899 }
890900
891901 if Self :: block_transactions_full ( ) {
892- return Err ( InvalidTransaction :: ExhaustsResources . into ( ) )
902+ return Err ( InvalidTransaction :: ExhaustsResources . into ( ) ) ;
893903 }
894904
895905 let hash = hash ( ) ;
@@ -939,13 +949,13 @@ pub mod pallet {
939949 . into ( )
940950 } ) )
941951 } ,
942- Call :: < T > :: remove_expired_preimage_authorization { hash } => {
943- Self :: check_authorization_expired ( AuthorizationScope :: Preimage ( * hash ) ) ?;
952+ Call :: < T > :: remove_expired_preimage_authorization { content_hash } => {
953+ Self :: check_authorization_expired ( AuthorizationScope :: Preimage ( * content_hash ) ) ?;
944954 Ok ( context. want_valid_transaction ( ) . then ( || {
945955 ValidTransaction :: with_tag_prefix (
946956 "TransactionStorageRemoveExpiredPreimageAuthorization" ,
947957 )
948- . and_provides ( hash )
958+ . and_provides ( content_hash )
949959 . priority ( T :: RemoveExpiredAuthorizationPriority :: get ( ) )
950960 . longevity ( T :: RemoveExpiredAuthorizationLongevity :: get ( ) )
951961 . into ( )
@@ -970,11 +980,11 @@ pub mod pallet {
970980 } ;
971981
972982 if !Self :: data_size_ok ( size) {
973- return Err ( BAD_DATA_SIZE . into ( ) )
983+ return Err ( BAD_DATA_SIZE . into ( ) ) ;
974984 }
975985
976986 if Self :: block_transactions_full ( ) {
977- return Err ( InvalidTransaction :: ExhaustsResources . into ( ) )
987+ return Err ( InvalidTransaction :: ExhaustsResources . into ( ) ) ;
978988 }
979989
980990 Self :: check_authorization (
0 commit comments