1234567891011121314151617use scale_info::TypeInfo;18use codec::{Encode, Decode};19use up_common::types::AccountId;20use crate::RuntimeCall;2122use sp_runtime::{23 traits::{DispatchInfoOf, SignedExtension},24 transaction_validity::{TransactionValidity, ValidTransaction, TransactionValidityError},25};2627#[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]28pub struct DisableIdentityCalls;2930impl SignedExtension for DisableIdentityCalls {31 type AccountId = AccountId;32 type Call = RuntimeCall;33 type AdditionalSigned = ();34 type Pre = ();3536 const IDENTIFIER: &'static str = "DisableIdentityCalls";3738 fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {39 Ok(())40 }4142 fn pre_dispatch(43 self,44 who: &Self::AccountId,45 call: &Self::Call,46 info: &DispatchInfoOf<Self::Call>,47 len: usize,48 ) -> Result<Self::Pre, TransactionValidityError> {49 self.validate(who, call, info, len).map(|_| ())50 }5152 fn validate(53 &self,54 _who: &Self::AccountId,55 call: &Self::Call,56 _info: &DispatchInfoOf<Self::Call>,57 _len: usize,58 ) -> TransactionValidity {59 match call {60 #[cfg(feature = "collator-selection")]61 RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),62 _ => Ok(ValidTransaction::default()),63 }64 }65}