From 0ac7af88c126b30ede6171e0cb7e4658a2f1413f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Andr=C3=A9s=20Dorado=20Su=C3=A1rez?= Date: Mon, 18 Nov 2024 22:08:58 -0500 Subject: [PATCH] fix(fc-pallet-pass): invalid data handling for extension Pre --- pallets/pass/src/extension.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pallets/pass/src/extension.rs b/pallets/pass/src/extension.rs index dbff0f5..582a07c 100644 --- a/pallets/pass/src/extension.rs +++ b/pallets/pass/src/extension.rs @@ -164,7 +164,7 @@ where type AccountId = S::AccountId; type Call = S::Call; type AdditionalSigned = S::AdditionalSigned; - type Pre = S::Pre; + type Pre = Option; fn additional_signed(&self) -> Result { self.0.additional_signed() @@ -191,9 +191,12 @@ where len: usize, ) -> Result { if Pallet::::signer_from_session_key(who).is_some() { - return Ok((None, Default::default())); + return Ok(None); } - self.0.pre_dispatch(&who, call, info, len) + + self.0 + .pre_dispatch(&who, call, info, len) + .map(|pre| Some(pre)) } fn post_dispatch( @@ -203,8 +206,8 @@ where len: usize, result: &sp_runtime::DispatchResult, ) -> Result<(), frame_support::pallet_prelude::TransactionValidityError> { - if let Some(pre) = pre { - S::post_dispatch(pre, info, post_info, len, result) + if let Some(Some(pre)) = pre { + S::post_dispatch(Some(pre), info, post_info, len, result) } else { Ok(()) }