mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 01:27:56 +00:00
Refactor SignedExtension (#5540)
* Refactor SignedExtension * Move DispatchInfo Associated type to Dispatchable * Bound Call: Dispatchable * Pass PostDispatchInfo to post_dispatch * Pass DispatchInfo by reference to avoid clones * Whitespace fix Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Style changes from code review Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Only decalre in test mod to remove warning * Deduplicate Call definition * Bound frame_system::trait::Call by Dispatchable * Introduce DispatchInfoOf type alias * Whitespace fix from review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
f8c8355ac7
commit
30ae26074c
@@ -53,7 +53,7 @@ pub enum Never {}
|
||||
/// Serializable version of Dispatchable.
|
||||
/// This value can be used as a "function" in an extrinsic.
|
||||
pub trait Callable<T> {
|
||||
type Call: Dispatchable<PostInfo=PostDispatchInfo> + Codec + Clone + PartialEq + Eq;
|
||||
type Call: Dispatchable<Info=DispatchInfo, PostInfo=PostDispatchInfo> + Codec + Clone + PartialEq + Eq;
|
||||
}
|
||||
|
||||
// dirty hack to work around serde_derive issue
|
||||
@@ -1593,6 +1593,7 @@ macro_rules! decl_module {
|
||||
{
|
||||
type Trait = $trait_instance;
|
||||
type Origin = $origin_type;
|
||||
type Info = $crate::weights::DispatchInfo;
|
||||
type PostInfo = $crate::weights::PostDispatchInfo;
|
||||
fn dispatch(self, _origin: Self::Origin) -> $crate::dispatch::DispatchResultWithPostInfo {
|
||||
match self {
|
||||
@@ -1720,6 +1721,7 @@ macro_rules! impl_outer_dispatch {
|
||||
impl $crate::dispatch::Dispatchable for $call_type {
|
||||
type Origin = $origin;
|
||||
type Trait = $call_type;
|
||||
type Info = $crate::weights::DispatchInfo;
|
||||
type PostInfo = $crate::weights::PostDispatchInfo;
|
||||
fn dispatch(
|
||||
self,
|
||||
|
||||
@@ -256,9 +256,8 @@ mod tests {
|
||||
struct TestExtension;
|
||||
impl sp_runtime::traits::SignedExtension for TestExtension {
|
||||
type AccountId = u32;
|
||||
type Call = u32;
|
||||
type Call = ();
|
||||
type AdditionalSigned = u32;
|
||||
type DispatchInfo = ();
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "testextension";
|
||||
fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {
|
||||
@@ -270,9 +269,8 @@ mod tests {
|
||||
struct TestExtension2;
|
||||
impl sp_runtime::traits::SignedExtension for TestExtension2 {
|
||||
type AccountId = u32;
|
||||
type Call = u32;
|
||||
type Call = ();
|
||||
type AdditionalSigned = u32;
|
||||
type DispatchInfo = ();
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "testextension2";
|
||||
fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {
|
||||
|
||||
Reference in New Issue
Block a user