@@ -35,13 +35,12 @@ use bp_runtime::{
3535} ;
3636use codec:: Encode ;
3737use frame_support:: {
38- dispatch:: Dispatchable ,
38+ dispatch:: { DispatchInfo , DispatchResultWithPostInfo , Dispatchable , Weight } ,
3939 ensure,
40+ pallet_prelude:: Pays ,
4041 traits:: Get ,
4142 weights:: GetDispatchInfo ,
4243} ;
43- use frame_support:: dispatch:: { DispatchInfo , DispatchResultWithPostInfo , Weight } ;
44- use frame_support:: pallet_prelude:: Pays ;
4544use frame_system:: RawOrigin ;
4645use sp_runtime:: traits:: { BadOrigin , Convert , IdentifyAccount , MaybeDisplay , Verify , Zero } ;
4746use sp_std:: { fmt:: Debug , prelude:: * } ;
@@ -164,10 +163,20 @@ impl<T: Config<I>, I: 'static> MessageDispatch<T::AccountId, T::BridgeMessageId>
164163 relayer_account : & T :: AccountId ,
165164 message : Result < & Self :: Message , ( ) > ,
166165 ) -> Result < ( ) , & ' static str > {
167- let raw_message = message. map_err ( |_| "Invalid Message" ) ?;
168- let call = raw_message. clone ( ) . call . into ( ) . map_err ( |_| "Invalid Call" ) ?;
166+ match message {
167+ Ok ( raw_message) =>
168+ if let Ok ( call) = raw_message. clone ( ) . call . into ( ) {
169+ return T :: CallValidator :: check_receiving_before_dispatch ( relayer_account, & call)
170+ } ,
171+ Err ( _) => {
172+ log:: trace!(
173+ target: "runtime::bridge-dispatch" ,
174+ "Message will be rejected in dispatch, still Ok here" ,
175+ ) ;
176+ } ,
177+ }
169178
170- T :: CallValidator :: check_receiving_before_dispatch ( relayer_account , & call )
179+ Ok ( ( ) )
171180 }
172181
173182 fn dispatch < P : FnOnce ( & T :: AccountId , bp_message_dispatch:: Weight ) -> Result < ( ) , ( ) > > (
@@ -379,7 +388,7 @@ fn extract_actual_weight(result: &DispatchResultWithPostInfo, info: &DispatchInf
379388 } ;
380389 match post_info. pays_fee {
381390 Pays :: Yes => post_info. calc_actual_weight ( info) ,
382- Pays :: No => Weight :: zero ( )
391+ Pays :: No => Weight :: zero ( ) ,
383392 }
384393}
385394
0 commit comments