difftreelog
fix after merge
in: master
1 file changed
runtime/common/identity.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use 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};26#[cfg(feature = "collator-selection")]27use sp_runtime::transaction_validity::InvalidTransaction;2829#[cfg(feature = "collator-selection")]30use sp_runtime::transaction_validity::InvalidTransaction;3132#[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]33pub struct DisableIdentityCalls;3435impl SignedExtension for DisableIdentityCalls {36 type AccountId = AccountId;37 type Call = RuntimeCall;38 type AdditionalSigned = ();39 type Pre = ();4041 const IDENTIFIER: &'static str = "DisableIdentityCalls";4243 fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {44 Ok(())45 }4647 fn pre_dispatch(48 self,49 who: &Self::AccountId,50 call: &Self::Call,51 info: &DispatchInfoOf<Self::Call>,52 len: usize,53 ) -> Result<Self::Pre, TransactionValidityError> {54 self.validate(who, call, info, len).map(|_| ())55 }5657 fn validate(58 &self,59 _who: &Self::AccountId,60 call: &Self::Call,61 _info: &DispatchInfoOf<Self::Call>,62 _len: usize,63 ) -> TransactionValidity {64 match call {65 #[cfg(feature = "collator-selection")]66 RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),67 _ => Ok(ValidTransaction::default()),68 }69 }70}