From 7177ad5cf07e9866f69ed95811b91edd977dd67e Mon Sep 17 00:00:00 2001 From: Gavin Wood <gavin@parity.io> Date: Thu, 5 Mar 2020 13:39:45 +0100 Subject: [PATCH] Remove `sender` from `Applyable`. (#5129) --- substrate/frame/executive/src/lib.rs | 4 ++-- .../primitives/runtime/src/generic/checked_extrinsic.rs | 5 ----- substrate/primitives/runtime/src/testing.rs | 3 --- substrate/primitives/runtime/src/traits.rs | 6 ------ 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/substrate/frame/executive/src/lib.rs b/substrate/frame/executive/src/lib.rs index d7fecf45909..022e26d3cb0 100644 --- a/substrate/frame/executive/src/lib.rs +++ b/substrate/frame/executive/src/lib.rs @@ -118,7 +118,7 @@ impl< where Block::Extrinsic: Checkable<Context> + Codec, CheckedOf<Block::Extrinsic, Context>: - Applyable<AccountId=System::AccountId, DispatchInfo=DispatchInfo> + + Applyable<DispatchInfo=DispatchInfo> + GetDispatchInfo, CallOf<Block::Extrinsic, Context>: Dispatchable, OriginOf<Block::Extrinsic, Context>: From<Option<System::AccountId>>, @@ -143,7 +143,7 @@ impl< where Block::Extrinsic: Checkable<Context> + Codec, CheckedOf<Block::Extrinsic, Context>: - Applyable<AccountId=System::AccountId, DispatchInfo=DispatchInfo> + + Applyable<DispatchInfo=DispatchInfo> + GetDispatchInfo, CallOf<Block::Extrinsic, Context>: Dispatchable, OriginOf<Block::Extrinsic, Context>: From<Option<System::AccountId>>, diff --git a/substrate/primitives/runtime/src/generic/checked_extrinsic.rs b/substrate/primitives/runtime/src/generic/checked_extrinsic.rs index 20aefbdf990..25a8274354a 100644 --- a/substrate/primitives/runtime/src/generic/checked_extrinsic.rs +++ b/substrate/primitives/runtime/src/generic/checked_extrinsic.rs @@ -45,14 +45,9 @@ where Origin: From<Option<AccountId>>, Info: Clone, { - type AccountId = AccountId; type Call = Call; type DispatchInfo = Info; - fn sender(&self) -> Option<&Self::AccountId> { - self.signed.as_ref().map(|x| &x.0) - } - fn validate<U: ValidateUnsigned<Call = Self::Call>>( &self, info: Self::DispatchInfo, diff --git a/substrate/primitives/runtime/src/testing.rs b/substrate/primitives/runtime/src/testing.rs index 6f6ea3dd164..e840cdd100c 100644 --- a/substrate/primitives/runtime/src/testing.rs +++ b/substrate/primitives/runtime/src/testing.rs @@ -410,12 +410,9 @@ impl<Origin, Call, Extra, Info> Applyable for TestXt<Call, Extra> where Origin: From<Option<u64>>, Info: Clone, { - type AccountId = u64; type Call = Call; type DispatchInfo = Info; - fn sender(&self) -> Option<&Self::AccountId> { self.signature.as_ref().map(|x| &x.0) } - /// Checks to see if this is a valid *transaction*. It returns information on it if so. fn validate<U: ValidateUnsigned<Call=Self::Call>>( &self, diff --git a/substrate/primitives/runtime/src/traits.rs b/substrate/primitives/runtime/src/traits.rs index d9c32d221c0..c6d85b22f46 100644 --- a/substrate/primitives/runtime/src/traits.rs +++ b/substrate/primitives/runtime/src/traits.rs @@ -879,18 +879,12 @@ impl SignedExtension for () { /// Also provides information on to whom this information is attributable and an index that allows /// each piece of attributable information to be disambiguated. pub trait Applyable: Sized + Send + Sync { - /// ID of the account that is responsible for this piece of information (sender). - type AccountId: Member + MaybeDisplay; - /// Type by which we can dispatch. Restricts the `UnsignedValidator` type. type Call; /// An opaque set of information attached to the transaction. type DispatchInfo: Clone; - /// Returns a reference to the sender if any. - fn sender(&self) -> Option<&Self::AccountId>; - /// Checks to see if this is a valid *transaction*. It returns information on it if so. fn validate<V: ValidateUnsigned<Call=Self::Call>>( &self, -- GitLab