@@ -61,6 +61,8 @@ mod tests;
61
61
mod benchmarking;
62
62
63
63
type BalanceOf < T > = <<T as Trait >:: Currency as Currency < <T as frame_system:: Trait >:: AccountId > >:: Balance ;
64
+ /// Just a bunch of bytes, but they should decode to a valid `Call`.
65
+ pub type OpaqueCall = Vec < u8 > ;
64
66
65
67
/// Configuration trait.
66
68
pub trait Trait : frame_system:: Trait {
@@ -122,7 +124,7 @@ decl_storage! {
122
124
hasher( twox_64_concat) T :: AccountId , hasher( blake2_128_concat) [ u8 ; 32 ]
123
125
=> Option <Multisig <T :: BlockNumber , BalanceOf <T >, T :: AccountId >>;
124
126
125
- pub Calls : map hasher( identity) [ u8 ; 32 ] => Option <( Vec < u8 > , T :: AccountId , BalanceOf <T >) >;
127
+ pub Calls : map hasher( identity) [ u8 ; 32 ] => Option <( OpaqueCall , T :: AccountId , BalanceOf <T >) >;
126
128
}
127
129
}
128
130
@@ -224,7 +226,7 @@ mod weight_of {
224
226
}
225
227
226
228
enum CallOrHash {
227
- Call ( Vec < u8 > , bool ) ,
229
+ Call ( OpaqueCall , bool ) ,
228
230
Hash ( [ u8 ; 32 ] ) ,
229
231
}
230
232
@@ -357,7 +359,7 @@ decl_module! {
357
359
threshold: u16 ,
358
360
other_signatories: Vec <T :: AccountId >,
359
361
maybe_timepoint: Option <Timepoint <T :: BlockNumber >>,
360
- call: Vec < u8 > ,
362
+ call: OpaqueCall ,
361
363
store_call: bool ,
362
364
max_weight: Weight ,
363
365
) -> DispatchResultWithPostInfo {
@@ -630,9 +632,12 @@ impl<T: Trait> Module<T> {
630
632
/// We store `data` here because storing `call` would result in needing another `.encode`.
631
633
///
632
634
/// Returns a `bool` indicating whether the data did end up being stored.
633
- fn store_call_and_reserve ( who : T :: AccountId , hash : & [ u8 ; 32 ] , data : Vec < u8 > , other_deposit : BalanceOf < T > )
634
- -> DispatchResult
635
- {
635
+ fn store_call_and_reserve (
636
+ who : T :: AccountId ,
637
+ hash : & [ u8 ; 32 ] ,
638
+ data : OpaqueCall ,
639
+ other_deposit : BalanceOf < T > ,
640
+ ) -> DispatchResult {
636
641
ensure ! ( !Calls :: <T >:: contains_key( hash) , Error :: <T >:: AlreadyStored ) ;
637
642
let deposit = other_deposit + T :: DepositBase :: get ( )
638
643
+ T :: DepositFactor :: get ( ) * BalanceOf :: < T > :: from ( ( ( data. len ( ) + 31 ) / 32 ) as u32 ) ;
0 commit comments