[][src]Trait sp_runtime::traits::SignedExtension

pub trait SignedExtension: Codec + Debug + Sync + Send + Clone + Eq + PartialEq {
    type AccountId;
    type Call;
    type AdditionalSigned: Encode;
    type Pre: Default;
    type DispatchInfo: Clone;

    const IDENTIFIER: &'static str;

    fn additional_signed(
        &self
    ) -> Result<Self::AdditionalSigned, TransactionValidityError>; fn validate(
        &self,
        _who: &Self::AccountId,
        _call: &Self::Call,
        _info: Self::DispatchInfo,
        _len: usize
    ) -> TransactionValidity { ... }
fn pre_dispatch(
        self,
        who: &Self::AccountId,
        call: &Self::Call,
        info: Self::DispatchInfo,
        len: usize
    ) -> Result<Self::Pre, TransactionValidityError> { ... }
fn validate_unsigned(
        _call: &Self::Call,
        _info: Self::DispatchInfo,
        _len: usize
    ) -> TransactionValidity { ... }
fn pre_dispatch_unsigned(
        call: &Self::Call,
        info: Self::DispatchInfo,
        len: usize
    ) -> Result<Self::Pre, TransactionValidityError> { ... }
fn post_dispatch(_pre: Self::Pre, _info: Self::DispatchInfo, _len: usize) { ... }
fn identifier() -> Vec<&'static str> { ... } }

Means by which a transaction may be extended. This type embodies both the data and the logic that should be additionally associated with the transaction. It should be plain old data.

Associated Types

type AccountId

The type which encodes the sender identity.

type Call

The type which encodes the call to be dispatched.

type AdditionalSigned: Encode

Any additional data that will go into the signed payload. This may be created dynamically from the transaction using the additional_signed function.

type Pre: Default

The type that encodes information that can be passed from pre_dispatch to post-dispatch.

type DispatchInfo: Clone

An opaque set of information attached to the transaction. This could be constructed anywhere down the line in a runtime. The current Substrate runtime uses a struct with the same name to represent the dispatch class and weight.

Loading content...

Associated Constants

const IDENTIFIER: &'static str

Unique identifier of this signed extension.

This will be exposed in the metadata to identify the signed extension used in an extrinsic.

Loading content...

Required methods

fn additional_signed(
    &self
) -> Result<Self::AdditionalSigned, TransactionValidityError>

Construct any additional data that should be in the signed payload of the transaction. Can also perform any pre-signature-verification checks and return an error if needed.

Loading content...

Provided methods

fn validate(
    &self,
    _who: &Self::AccountId,
    _call: &Self::Call,
    _info: Self::DispatchInfo,
    _len: usize
) -> TransactionValidity

Validate a signed transaction for the transaction queue.

This function can be called frequently by the transaction queue, to obtain transaction validity against current state. It should perform all checks that determine a valid transaction, that can pay for its execution and quickly eliminate ones that are stale or incorrect.

Make sure to perform the same checks in pre_dispatch function.

fn pre_dispatch(
    self,
    who: &Self::AccountId,
    call: &Self::Call,
    info: Self::DispatchInfo,
    len: usize
) -> Result<Self::Pre, TransactionValidityError>

Do any pre-flight stuff for a signed transaction.

Note this function by default delegates to validate, so that all checks performed for the transaction queue are also performed during the dispatch phase (applying the extrinsic).

If you ever override this function, you need to make sure to always perform the same validation as in validate.

fn validate_unsigned(
    _call: &Self::Call,
    _info: Self::DispatchInfo,
    _len: usize
) -> TransactionValidity

Validate an unsigned transaction for the transaction queue.

This function can be called frequently by the transaction queue to obtain transaction validity against current state. It should perform all checks that determine a valid unsigned transaction, and quickly eliminate ones that are stale or incorrect.

Make sure to perform the same checks in pre_dispatch_unsigned function.

fn pre_dispatch_unsigned(
    call: &Self::Call,
    info: Self::DispatchInfo,
    len: usize
) -> Result<Self::Pre, TransactionValidityError>

Do any pre-flight stuff for a unsigned transaction.

Note this function by default delegates to validate_unsigned, so that all checks performed for the transaction queue are also performed during the dispatch phase (applying the extrinsic).

If you ever override this function, you need to make sure to always perform the same validation as in validate_unsigned.

fn post_dispatch(_pre: Self::Pre, _info: Self::DispatchInfo, _len: usize)

Do any post-flight stuff for a transaction.

fn identifier() -> Vec<&'static str>

Returns the list of unique identifier for this signed extension.

As a SignedExtension can be a tuple of SignedExtensions we need to return a Vecthat holds all the unique identifiers. Each individualSignedExtension` must return exactly one identifier.

This method provides a default implementation that returns vec![SELF::IDENTIFIER].

Loading content...

Implementations on Foreign Types

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension> SignedExtension for (TupleElement0,) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned,)

type Pre = (TupleElement0::Pre,)

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension, TupleElement1: SignedExtension> SignedExtension for (TupleElement0, TupleElement1) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre)

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre)

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre)

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre)

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre)

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre)

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension, TupleElement7: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement7: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned, TupleElement7::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre, TupleElement7::Pre)

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension, TupleElement7: SignedExtension, TupleElement8: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement7: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement8: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned, TupleElement7::AdditionalSigned, TupleElement8::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre, TupleElement7::Pre, TupleElement8::Pre)

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension, TupleElement7: SignedExtension, TupleElement8: SignedExtension, TupleElement9: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement7: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement8: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement9: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned, TupleElement7::AdditionalSigned, TupleElement8::AdditionalSigned, TupleElement9::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre, TupleElement7::Pre, TupleElement8::Pre, TupleElement9::Pre)

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension, TupleElement7: SignedExtension, TupleElement8: SignedExtension, TupleElement9: SignedExtension, TupleElement10: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement7: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement8: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement9: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement10: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned, TupleElement7::AdditionalSigned, TupleElement8::AdditionalSigned, TupleElement9::AdditionalSigned, TupleElement10::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre, TupleElement7::Pre, TupleElement8::Pre, TupleElement9::Pre, TupleElement10::Pre)

impl<AccountId, Call, Info: Clone, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension, TupleElement7: SignedExtension, TupleElement8: SignedExtension, TupleElement9: SignedExtension, TupleElement10: SignedExtension, TupleElement11: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10, TupleElement11) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement7: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement8: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement9: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement10: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>,
    TupleElement11: SignedExtension<AccountId = AccountId, Call = Call, DispatchInfo = Info>, 
[src]

type AccountId = AccountId

type Call = Call

type DispatchInfo = Info

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned, TupleElement7::AdditionalSigned, TupleElement8::AdditionalSigned, TupleElement9::AdditionalSigned, TupleElement10::AdditionalSigned, TupleElement11::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre, TupleElement7::Pre, TupleElement8::Pre, TupleElement9::Pre, TupleElement10::Pre, TupleElement11::Pre)

impl SignedExtension for ()[src]

Only for bare bone testing when you don't care about signed extensions at all.

Loading content...

Implementors

Loading content...