difftreelog
fix check maintenance in self-contained
in: master
1 file changed
runtime/common/ethereum/self_contained_call.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 sp_core::H160;18use sp_runtime::{19 traits::{Dispatchable, DispatchInfoOf, PostDispatchInfoOf},20 transaction_validity::{TransactionValidityError, TransactionValidity},21};22use crate::{RuntimeOrigin, RuntimeCall};2324impl fp_self_contained::SelfContainedCall for RuntimeCall {25 type SignedInfo = H160;2627 fn is_self_contained(&self) -> bool {28 match self {29 RuntimeCall::Ethereum(call) => call.is_self_contained(),30 _ => false,31 }32 }3334 fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {35 match self {36 RuntimeCall::Ethereum(call) => call.check_self_contained(),37 _ => None,38 }39 }4041 fn validate_self_contained(42 &self,43 info: &Self::SignedInfo,44 dispatch_info: &DispatchInfoOf<RuntimeCall>,45 len: usize,46 ) -> Option<TransactionValidity> {47 match self {48 RuntimeCall::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len),49 _ => None,50 }51 }5253 fn pre_dispatch_self_contained(54 &self,55 info: &Self::SignedInfo,56 ) -> Option<Result<(), TransactionValidityError>> {57 match self {58 RuntimeCall::Ethereum(call) => call.pre_dispatch_self_contained(info),59 _ => None,60 }61 }6263 fn apply_self_contained(64 self,65 info: Self::SignedInfo,66 ) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {67 match self {68 call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => {69 Some(call.dispatch(RuntimeOrigin::from(70 pallet_ethereum::RawOrigin::EthereumTransaction(info),71 )))72 }73 _ => None,74 }75 }76}